• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 didSetM44(const SkM44&) override;
36     void didScale(SkScalar, SkScalar) override;
37     void didTranslate(SkScalar, SkScalar) override;
38 
39     void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
40     void onDrawGlyphRunList(const SkGlyphRunList&, 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 
56     void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
57                       const SkPaint*) override;
58     void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&,
59                           const SkPaint*, SrcRectConstraint) override;
60     void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect&, SkFilterMode,
61                              const SkPaint*) override;
62     void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int,
63                   SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override;
64 
65     void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override;
66     void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override;
67 
68     void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override;
69     void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override;
70     void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override;
71     void onClipShader(sk_sp<SkShader>, SkClipOp) override;
72     void onClipRegion(const SkRegion&, SkClipOp) override;
73     void onResetClip() override;
74 
75     void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
76     void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
77     void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
78 
79     void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
80                           SkBlendMode) override;
81     void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
82                                const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override;
83 
84     void onFlush() override;
85 
86     class Iter;
87 
88 private:
89     using INHERITED = SkCanvasVirtualEnforcer<SkNoDrawCanvas>;
90 };
91 
92 
93 #endif
94