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 "SkCanvasVirtualEnforcer.h" 14 #include "SkNoDrawCanvas.h" 15 16 class SK_API SkNWayCanvas : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> { 17 public: 18 SkNWayCanvas(int width, int height); 19 ~SkNWayCanvas() override; 20 21 virtual void addCanvas(SkCanvas*); 22 virtual void removeCanvas(SkCanvas*); 23 virtual void removeAll(); 24 25 protected: 26 SkTDArray<SkCanvas*> fList; 27 28 void willSave() override; 29 SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override; 30 bool onDoSaveBehind(const SkRect*) override; 31 void willRestore() override; 32 33 void didConcat(const SkMatrix&) override; 34 void didSetMatrix(const SkMatrix&) override; 35 36 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; 37 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 38 const SkPaint& paint) override; 39 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], 40 const SkPoint texCoords[4], SkBlendMode, 41 const SkPaint& paint) override; 42 43 void onDrawPaint(const SkPaint&) override; 44 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; 45 void onDrawRect(const SkRect&, const SkPaint&) override; 46 void onDrawEdgeAARect(const SkRect&, SkCanvas::QuadAAFlags, SkColor, SkBlendMode) override; 47 void onDrawRegion(const SkRegion&, const SkPaint&) override; 48 void onDrawOval(const SkRect&, const SkPaint&) override; 49 void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; 50 void onDrawRRect(const SkRRect&, const SkPaint&) override; 51 void onDrawPath(const SkPath&, const SkPaint&) override; 52 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override; 53 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, 54 SrcRectConstraint) override; 55 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override; 56 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, 57 const SkPaint*, SrcRectConstraint) override; 58 void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&, 59 const SkPaint*) override; 60 void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, const SkPaint*) override; 61 void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, 62 const SkPaint*) override; 63 void onDrawImageSet(const SkCanvas::ImageSetEntry[], int count, SkFilterQuality, 64 SkBlendMode) override; 65 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, 66 const SkPaint*) override; 67 void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount, 68 SkBlendMode, const SkPaint&) override; 69 void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], 70 int, SkBlendMode, const SkRect*, const SkPaint*) override; 71 void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; 72 73 void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; 74 void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; 75 void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; 76 void onClipRegion(const SkRegion&, SkClipOp) override; 77 78 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; 79 void onDrawDrawable(SkDrawable*, const SkMatrix*) override; 80 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; 81 82 void onFlush() override; 83 84 class Iter; 85 86 private: 87 typedef SkCanvasVirtualEnforcer<SkNoDrawCanvas> INHERITED; 88 }; 89 90 91 #endif 92