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