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 "include/core/SkBlurTypes.h" 13 #include "include/core/SkCanvasVirtualEnforcer.h" 14 #include "include/private/SkTDArray.h" 15 #include "include/utils/SkNoDrawCanvas.h" 16 17 class SK_API SkNWayCanvas : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> { 18 public: 19 SkNWayCanvas(int width, int height); 20 ~SkNWayCanvas() override; 21 22 virtual void addCanvas(SkCanvas*); 23 virtual void removeCanvas(SkCanvas*); 24 virtual void removeAll(); 25 26 protected: 27 SkTDArray<SkCanvas*> fList; 28 29 void willSave() override; 30 SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override; 31 bool onDoSaveBehind(const SkRect*) override; 32 void willRestore() override; 33 34 void onMarkCTM(const char*) override; 35 void didConcat44(const SkM44&) override; 36 void didSetM44(const SkM44&) override; 37 void didScale(SkScalar, SkScalar) override; 38 void didTranslate(SkScalar, SkScalar) override; 39 40 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; 41 void onDrawGlyphRunList(const SkGlyphRunList&, const SkPaint&) override; 42 void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 43 const SkPaint& paint) override; 44 void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], 45 const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint) override; 46 47 void onDrawPaint(const SkPaint&) override; 48 void onDrawBehind(const SkPaint&) override; 49 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; 50 void onDrawRect(const SkRect&, const SkPaint&) override; 51 void onDrawRegion(const SkRegion&, const SkPaint&) override; 52 void onDrawOval(const SkRect&, const SkPaint&) override; 53 void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; 54 void onDrawRRect(const SkRRect&, const SkPaint&) override; 55 void onDrawPath(const SkPath&, const SkPaint&) override; 56 57 void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&, 58 const SkPaint*) override; 59 void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&, 60 const SkPaint*, SrcRectConstraint) override; 61 void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect&, SkFilterMode, 62 const SkPaint*) override; 63 void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, 64 SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override; 65 66 void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; 67 void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; 68 69 void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; 70 void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; 71 void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; 72 void onClipShader(sk_sp<SkShader>, SkClipOp) override; 73 void onClipRegion(const SkRegion&, SkClipOp) override; 74 void onResetClip() override; 75 76 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; 77 void onDrawDrawable(SkDrawable*, const SkMatrix*) override; 78 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; 79 80 void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&, 81 SkBlendMode) override; 82 void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], 83 const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override; 84 85 void onFlush() override; 86 87 bool onDrawBlurImage(const SkImage* image, const SkBlurArg& blurArg) override; 88 89 class Iter; 90 91 private: 92 using INHERITED = SkCanvasVirtualEnforcer<SkNoDrawCanvas>; 93 }; 94 95 96 #endif 97