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/SkCanvasVirtualEnforcer.h" 13 #include "include/private/SkTDArray.h" 14 #include "include/utils/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 didConcat44(const SkM44&) override; 34 void didSetM44(const SkM44&) override; 35 void didScale(SkScalar, SkScalar) override; 36 void didTranslate(SkScalar, SkScalar) override; 37 38 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; 39 void onDrawGlyphRunList(const SkGlyphRunList&, const SkPaint&) override; 40 void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 41 const SkPaint& paint) override; 42 void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], 43 const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint) override; 44 45 void onDrawPaint(const SkPaint&) override; 46 void onDrawBehind(const SkPaint&) override; 47 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; 48 void onDrawRect(const SkRect&, const SkPaint&) override; 49 void onDrawRegion(const SkRegion&, const SkPaint&) override; 50 void onDrawOval(const SkRect&, const SkPaint&) override; 51 void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; 52 void onDrawRRect(const SkRRect&, const SkPaint&) override; 53 void onDrawPath(const SkPath&, const SkPaint&) override; 54 55 void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&, 56 const SkPaint*) override; 57 void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&, 58 const SkPaint*, SrcRectConstraint) override; 59 void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect&, SkFilterMode, 60 const SkPaint*) override; 61 void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, 62 SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override; 63 64 void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; 65 void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; 66 67 void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; 68 void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; 69 void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; 70 void onClipShader(sk_sp<SkShader>, SkClipOp) override; 71 void onClipRegion(const SkRegion&, SkClipOp) override; 72 void onResetClip() override; 73 74 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; 75 void onDrawDrawable(SkDrawable*, const SkMatrix*) override; 76 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; 77 78 void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&, 79 SkBlendMode) override; 80 void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], 81 const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override; 82 83 void onFlush() override; 84 85 class Iter; 86 87 private: 88 using INHERITED = SkCanvasVirtualEnforcer<SkNoDrawCanvas>; 89 }; 90 91 92 #endif 93