| 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 onMarkCTM(const char*) override; |
| 34 | void didConcat44(const SkM44&) override; |
| 35 | void didConcat(const SkMatrix&) override; |
| 36 | void didSetMatrix(const SkMatrix&) 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 onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 42 | const SkPaint& paint) override; |
| 43 | void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
| 44 | const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint) override; |
| 45 | |
| 46 | void onDrawPaint(const SkPaint&) override; |
| 47 | void onDrawBehind(const SkPaint&) override; |
| 48 | void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; |
| 49 | void onDrawRect(const SkRect&, const SkPaint&) override; |
| 50 | void onDrawRegion(const SkRegion&, const SkPaint&) override; |
| 51 | void onDrawOval(const SkRect&, const SkPaint&) override; |
| 52 | void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; |
| 53 | void onDrawRRect(const SkRRect&, const SkPaint&) override; |
| 54 | void onDrawPath(const SkPath&, const SkPaint&) 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 onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, const SkPaint*) override; |
| 59 | void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, |
| 60 | const SkPaint*) override; |
| 61 | void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; |
| 62 | void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], |
| 63 | int, SkBlendMode, const SkRect*, const SkPaint*) override; |
| 64 | void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; |
| 65 | |
| 66 | void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; |
| 67 | void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; |
| 68 | void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; |
| 69 | void onClipShader(sk_sp<SkShader>, SkClipOp) override; |
| 70 | void onClipRegion(const SkRegion&, SkClipOp) override; |
| 71 | |
| 72 | void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; |
| 73 | void onDrawDrawable(SkDrawable*, const SkMatrix*) override; |
| 74 | void onDrawAnnotation(const SkRect&, const char[], SkData*) override; |
| 75 | |
| 76 | void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&, |
| 77 | SkBlendMode) override; |
| 78 | void onDrawEdgeAAImageSet(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], |
| 79 | const SkPaint*, SrcRectConstraint) override; |
| 80 | |
| 81 | void onFlush() override; |
| 82 | |
| 83 | class Iter; |
| 84 | |
| 85 | private: |
| 86 | typedef SkCanvasVirtualEnforcer<SkNoDrawCanvas> INHERITED; |
| 87 | }; |
| 88 | |
| 89 | |
| 90 | #endif |
| 91 | |