OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef SkProxyCanvas_DEFINED | 8 #ifndef SkProxyCanvas_DEFINED |
9 #define SkProxyCanvas_DEFINED | 9 #define SkProxyCanvas_DEFINED |
10 | 10 |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 | 12 |
13 /** This class overrides all virtual methods on SkCanvas, and redirects them | 13 /** This class overrides all virtual methods on SkCanvas, and redirects them |
14 to a "proxy", another SkCanvas instance. It can be the basis for | 14 to a "proxy", another SkCanvas instance. It can be the basis for |
15 intercepting (and possibly modifying) calls to a canvas. | 15 intercepting (and possibly modifying) calls to a canvas. |
16 | 16 |
17 There must be a proxy installed before the proxycanvas can be used (i.e. | 17 There must be a proxy installed before the proxycanvas can be used (i.e. |
18 before its virtual methods can be called). | 18 before its virtual methods can be called). |
19 */ | 19 */ |
20 class SK_API SkProxyCanvas : public SkCanvas { | 20 class SK_API SkProxyCanvas : public SkCanvas { |
21 public: | 21 public: |
22 SkProxyCanvas() : fProxy(NULL) {} | 22 SkProxyCanvas() : fProxy(NULL) {} |
23 SkProxyCanvas(SkCanvas* proxy); | 23 SkProxyCanvas(SkCanvas* proxy); |
24 virtual ~SkProxyCanvas(); | 24 virtual ~SkProxyCanvas(); |
25 | 25 |
26 SkCanvas* getProxy() const { return fProxy; } | 26 SkCanvas* getProxy() const { return fProxy; } |
27 void setProxy(SkCanvas* proxy); | 27 void setProxy(SkCanvas* proxy); |
28 | 28 |
29 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; | 29 void beginCommentGroup(const char* description) SK_OVERRIDE; |
30 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 30 void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
31 virtual void endCommentGroup() SK_OVERRIDE; | 31 void endCommentGroup() SK_OVERRIDE; |
32 | 32 |
33 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE; | 33 SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE; |
34 | 34 |
35 protected: | 35 protected: |
36 virtual void willSave() SK_OVERRIDE; | 36 void willSave() SK_OVERRIDE; |
37 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF
lags) SK_OVERRIDE; | 37 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK
_OVERRIDE; |
38 virtual void willRestore() SK_OVERRIDE; | 38 void willRestore() SK_OVERRIDE; |
39 | 39 |
40 virtual void didConcat(const SkMatrix&) SK_OVERRIDE; | 40 void didConcat(const SkMatrix&) SK_OVERRIDE; |
41 virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 41 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
42 | 42 |
43 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK
_OVERRIDE; | 43 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; |
44 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, | 44 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, |
45 const SkPaint&) SK_OVERRIDE; | 45 const SkPaint&) SK_OVERRIDE; |
46 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], | 46 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], |
47 const SkPaint&) SK_OVERRIDE; | 47 const SkPaint&) SK_OVERRIDE; |
48 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], | 48 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], |
49 SkScalar constY, const SkPaint&) SK_OVERRIDE; | 49 SkScalar constY, const SkPaint&) SK_OVERRIDE; |
50 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 50 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
51 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; | 51 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; |
52 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 52 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
53 const SkPaint& paint) SK_OVERRIDE; | 53 const SkPaint& paint) SK_OVERRIDE; |
(...skipping 15 matching lines...) Expand all Loading... |
69 const SkPaint*) SK_OVERRIDE; | 69 const SkPaint*) SK_OVERRIDE; |
70 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, | 70 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, |
71 const SkPaint*) SK_OVERRIDE; | 71 const SkPaint*) SK_OVERRIDE; |
72 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; | 72 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; |
73 void onDrawVertices(VertexMode vmode, int vertexCount, | 73 void onDrawVertices(VertexMode vmode, int vertexCount, |
74 const SkPoint vertices[], const SkPoint texs[], | 74 const SkPoint vertices[], const SkPoint texs[], |
75 const SkColor colors[], SkXfermode* xmode, | 75 const SkColor colors[], SkXfermode* xmode, |
76 const uint16_t indices[], int indexCount, | 76 const uint16_t indices[], int indexCount, |
77 const SkPaint&) SK_OVERRIDE; | 77 const SkPaint&) SK_OVERRIDE; |
78 | 78 |
79 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 79 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
80 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; | 80 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
81 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 81 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
82 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 82 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; |
83 | 83 |
84 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*
) SK_OVERRIDE; | 84 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE; |
85 | 85 |
86 private: | 86 private: |
87 SkCanvas* fProxy; | 87 SkCanvas* fProxy; |
88 | 88 |
89 typedef SkCanvas INHERITED; | 89 typedef SkCanvas INHERITED; |
90 }; | 90 }; |
91 | 91 |
92 #endif | 92 #endif |
OLD | NEW |