1 2 /* 3 * Copyright 2011 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 #ifndef SkNWayCanvas_DEFINED 10 #define SkNWayCanvas_DEFINED 11 12 #include "../private/SkTDArray.h" 13 #include "SkCanvas.h" 14 15 class SK_API SkNWayCanvas : public SkCanvas { 16 public: 17 SkNWayCanvas(int width, int height); 18 virtual ~SkNWayCanvas(); 19 20 virtual void addCanvas(SkCanvas*); 21 virtual void removeCanvas(SkCanvas*); 22 virtual void removeAll(); 23 24 /////////////////////////////////////////////////////////////////////////// 25 // These are forwarded to the N canvases we're referencing 26 27 #ifdef SK_SUPPORT_LEGACY_DRAWFILTER 28 SkDrawFilter* setDrawFilter(SkDrawFilter*) override; 29 #endif 30 31 protected: 32 SkTDArray<SkCanvas*> fList; 33 34 void willSave() override; 35 SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override; 36 void willRestore() override; 37 38 void didConcat(const SkMatrix&) override; 39 void didSetMatrix(const SkMatrix&) override; 40 41 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; 42 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, 43 const SkPaint&) override; 44 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], 45 const SkPaint&) override; 46 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], 47 SkScalar constY, const SkPaint&) override; 48 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, 49 const SkMatrix* matrix, const SkPaint&) override; 50 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 51 const SkPaint& paint) override; 52 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], 53 const SkPoint texCoords[4], SkXfermode* xmode, 54 const SkPaint& paint) override; 55 56 void onDrawPaint(const SkPaint&) override; 57 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; 58 void onDrawRect(const SkRect&, const SkPaint&) override; 59 void onDrawOval(const SkRect&, const SkPaint&) override; 60 void onDrawRRect(const SkRRect&, const SkPaint&) override; 61 void onDrawPath(const SkPath&, const SkPaint&) override; 62 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override; 63 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, 64 SrcRectConstraint) override; 65 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override; 66 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, 67 const SkPaint*, SrcRectConstraint) override; 68 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, 69 const SkPaint*) override; 70 void onDrawVertices(VertexMode vmode, int vertexCount, 71 const SkPoint vertices[], const SkPoint texs[], 72 const SkColor colors[], SkXfermode* xmode, 73 const uint16_t indices[], int indexCount, 74 const SkPaint&) override; 75 76 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; 77 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; 78 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; 79 void onClipRegion(const SkRegion&, SkRegion::Op) override; 80 81 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; 82 83 class Iter; 84 85 private: 86 typedef SkCanvas INHERITED; 87 }; 88 89 90 #endif 91