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 onDrawBehind(const SkPaint&) override; 45 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; 46 void onDrawRect(const SkRect&, const SkPaint&) override; 47 void onDrawEdgeAARect(const SkRect&, SkCanvas::QuadAAFlags, SkColor, SkBlendMode) override; 48 void onDrawRegion(const SkRegion&, const SkPaint&) override; 49 void onDrawOval(const SkRect&, const SkPaint&) override; 50 void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; 51 void onDrawRRect(const SkRRect&, const SkPaint&) override; 52 void onDrawPath(const SkPath&, const SkPaint&) override; 53 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override; 54 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, 55 SrcRectConstraint) override; 56 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override; 57 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, 58 const SkPaint*, SrcRectConstraint) override; 59 void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&, 60 const SkPaint*) override; 61 void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, const SkPaint*) override; 62 void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, 63 const SkPaint*) override; 64 void onDrawImageSet(const SkCanvas::ImageSetEntry[], int count, SkFilterQuality, 65 SkBlendMode) override; 66 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, 67 const SkPaint*) override; 68 void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount, 69 SkBlendMode, const SkPaint&) override; 70 void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], 71 int, SkBlendMode, const SkRect*, const SkPaint*) override; 72 void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; 73 74 void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; 75 void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; 76 void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; 77 void onClipRegion(const SkRegion&, SkClipOp) override; 78 79 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; 80 void onDrawDrawable(SkDrawable*, const SkMatrix*) override; 81 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; 82 83 void onFlush() override; 84 85 class Iter; 86 87 private: 88 typedef SkCanvasVirtualEnforcer<SkNoDrawCanvas> INHERITED; 89 }; 90 91 92 #endif 93