OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkTrackDevice_DEFINED | 8 #ifndef SkTrackDevice_DEFINED |
9 #define SkTrackDevice_DEFINED | 9 #define SkTrackDevice_DEFINED |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 protected: | 42 protected: |
43 #if 0 // clear is deprecated (and private) | 43 #if 0 // clear is deprecated (and private) |
44 virtual void clear(SkColor color) { | 44 virtual void clear(SkColor color) { |
45 before(); | 45 before(); |
46 INHERITED::clear(color); | 46 INHERITED::clear(color); |
47 after(); | 47 after(); |
48 } | 48 } |
49 #endif | 49 #endif |
50 | 50 |
51 virtual void drawPaint(const SkDraw& dummy1, const SkPaint& paint) { | 51 void drawPaint(const SkDraw& dummy1, const SkPaint& paint) override { |
52 before(); | 52 before(); |
53 INHERITED::drawPaint(dummy1, paint); | 53 INHERITED::drawPaint(dummy1, paint); |
54 after(); | 54 after(); |
55 } | 55 } |
56 | 56 |
57 virtual void drawPoints(const SkDraw& dummy1, SkCanvas::PointMode mode, size
_t count, | 57 void drawPoints(const SkDraw& dummy1, SkCanvas::PointMode mode, size_t count
, |
58 const SkPoint dummy2[], const SkPaint& paint) { | 58 const SkPoint dummy2[], const SkPaint& paint) override { |
59 before(); | 59 before(); |
60 INHERITED::drawPoints(dummy1, mode, count, dummy2, paint); | 60 INHERITED::drawPoints(dummy1, mode, count, dummy2, paint); |
61 after(); | 61 after(); |
62 } | 62 } |
63 | 63 |
64 virtual void drawRect(const SkDraw& dummy1, const SkRect& r, | 64 void drawRect(const SkDraw& dummy1, const SkRect& r, const SkPaint& paint) o
verride { |
65 const SkPaint& paint) { | |
66 before(); | 65 before(); |
67 INHERITED::drawRect(dummy1, r, paint); | 66 INHERITED::drawRect(dummy1, r, paint); |
68 after(); | 67 after(); |
69 } | 68 } |
70 | 69 |
71 | 70 |
72 virtual void drawOval(const SkDraw& dummy1, const SkRect& oval, | 71 void drawOval(const SkDraw& dummy1, const SkRect& oval, const SkPaint& paint
) override { |
73 const SkPaint& paint) { | |
74 before(); | 72 before(); |
75 INHERITED::drawOval(dummy1, oval, paint); | 73 INHERITED::drawOval(dummy1, oval, paint); |
76 after(); | 74 after(); |
77 } | 75 } |
78 | 76 |
79 virtual void drawRRect(const SkDraw& dummy1, const SkRRect& rr, | 77 void drawRRect(const SkDraw& dummy1, const SkRRect& rr, const SkPaint& paint
) override { |
80 const SkPaint& paint) { | |
81 before(); | 78 before(); |
82 INHERITED::drawRRect(dummy1, rr, paint); | 79 INHERITED::drawRRect(dummy1, rr, paint); |
83 after(); | 80 after(); |
84 } | 81 } |
85 | 82 |
86 virtual void drawPath(const SkDraw& dummy1, const SkPath& path, | 83 void drawPath(const SkDraw& dummy1, const SkPath& path, |
87 const SkPaint& paint, | 84 const SkPaint& paint, |
88 const SkMatrix* prePathMatrix = NULL, | 85 const SkMatrix* prePathMatrix = NULL, |
89 bool pathIsMutable = false) { | 86 bool pathIsMutable = false) override { |
90 before(); | 87 before(); |
91 INHERITED::drawPath(dummy1, path, paint, prePathMatrix, pathIsMutable); | 88 INHERITED::drawPath(dummy1, path, paint, prePathMatrix, pathIsMutable); |
92 after(); | 89 after(); |
93 } | 90 } |
94 | 91 |
95 virtual void drawBitmap(const SkDraw& dummy1, const SkBitmap& bitmap, | 92 void drawBitmap(const SkDraw& dummy1, const SkBitmap& bitmap, |
96 const SkMatrix& matrix, const SkPaint& paint) { | 93 const SkMatrix& matrix, const SkPaint& paint) override { |
97 before(); | 94 before(); |
98 INHERITED::drawBitmap(dummy1, bitmap, matrix, paint); | 95 INHERITED::drawBitmap(dummy1, bitmap, matrix, paint); |
99 after(); | 96 after(); |
100 } | 97 } |
101 | 98 |
102 virtual void drawSprite(const SkDraw& dummy1, const SkBitmap& bitmap, | 99 void drawSprite(const SkDraw& dummy1, const SkBitmap& bitmap, |
103 int x, int y, const SkPaint& paint) { | 100 int x, int y, const SkPaint& paint) override { |
104 before(); | 101 before(); |
105 INHERITED::drawSprite(dummy1, bitmap, x, y, paint); | 102 INHERITED::drawSprite(dummy1, bitmap, x, y, paint); |
106 after(); | 103 after(); |
107 } | 104 } |
108 | 105 |
109 virtual void drawBitmapRect(const SkDraw& dummy1, const SkBitmap& dummy2, | 106 void drawBitmapRect(const SkDraw& dummy1, const SkBitmap& dummy2, |
110 const SkRect* srcOrNull, const SkRect& dst, | 107 const SkRect* srcOrNull, const SkRect& dst, |
111 const SkPaint& paint, | 108 const SkPaint& paint, |
112 SkCanvas::DrawBitmapRectFlags flags) { | 109 SK_VIRTUAL_CONSTRAINT_TYPE flags) override { |
113 before(); | 110 before(); |
114 INHERITED::drawBitmapRect(dummy1, dummy2, srcOrNull, dst, paint, flags); | 111 INHERITED::drawBitmapRect(dummy1, dummy2, srcOrNull, dst, paint, flags); |
115 after(); | 112 after(); |
116 } | 113 } |
117 | 114 |
118 virtual void drawText(const SkDraw& dummy1, const void* text, size_t len, | 115 void drawText(const SkDraw& dummy1, const void* text, size_t len, |
119 SkScalar x, SkScalar y, const SkPaint& paint) { | 116 SkScalar x, SkScalar y, const SkPaint& paint) override { |
120 before(); | 117 before(); |
121 INHERITED::drawText(dummy1, text, len, x, y, paint); | 118 INHERITED::drawText(dummy1, text, len, x, y, paint); |
122 after(); | 119 after(); |
123 } | 120 } |
124 | 121 |
125 virtual void drawPosText(const SkDraw& dummy1, const void* text, size_t len, | 122 void drawPosText(const SkDraw& dummy1, const void* text, size_t len, |
126 const SkScalar pos[], int scalarsPerPos, | 123 const SkScalar pos[], int scalarsPerPos, |
127 const SkPoint& offset, const SkPaint& paint) { | 124 const SkPoint& offset, const SkPaint& paint) override { |
128 before(); | 125 before(); |
129 INHERITED::drawPosText(dummy1, text, len, pos, scalarsPerPos, offset, pa
int); | 126 INHERITED::drawPosText(dummy1, text, len, pos, scalarsPerPos, offset, pa
int); |
130 after(); | 127 after(); |
131 } | 128 } |
132 | 129 |
133 virtual void drawTextOnPath(const SkDraw& dummy1, const void* text, size_t l
en, | 130 void drawTextOnPath(const SkDraw& dummy1, const void* text, size_t len, |
134 const SkPath& path, const SkMatrix* matrix, | 131 const SkPath& path, const SkMatrix* matrix, |
135 const SkPaint& paint) { | 132 const SkPaint& paint) override { |
136 before(); | 133 before(); |
137 INHERITED::drawTextOnPath(dummy1, text, len, path, matrix, paint); | 134 INHERITED::drawTextOnPath(dummy1, text, len, path, matrix, paint); |
138 after(); | 135 after(); |
139 } | 136 } |
140 | 137 |
141 virtual void drawVertices(const SkDraw& dummy1, SkCanvas::VertexMode dummy2,
int vertexCount, | 138 void drawVertices(const SkDraw& dummy1, SkCanvas::VertexMode dummy2, int ver
texCount, |
142 const SkPoint verts[], const SkPoint texs[], | 139 const SkPoint verts[], const SkPoint texs[], |
143 const SkColor colors[], SkXfermode* xmode, | 140 const SkColor colors[], SkXfermode* xmode, |
144 const uint16_t indices[], int indexCount, | 141 const uint16_t indices[], int indexCount, |
145 const SkPaint& paint) { | 142 const SkPaint& paint) override { |
146 before(); | 143 before(); |
147 INHERITED::drawVertices(dummy1, dummy2, vertexCount,verts, texs,colors,
xmode, indices, | 144 INHERITED::drawVertices(dummy1, dummy2, vertexCount,verts, texs,colors,
xmode, indices, |
148 indexCount, paint); | 145 indexCount, paint); |
149 after(); | 146 after(); |
150 } | 147 } |
151 | 148 |
152 virtual void drawDevice(const SkDraw& dummy1, SkBaseDevice* dummy2, int x, i
nt y, | 149 void drawDevice(const SkDraw& dummy1, SkBaseDevice* dummy2, int x, int y, |
153 const SkPaint& dummy3) { | 150 const SkPaint& dummy3) override { |
154 before(); | 151 before(); |
155 INHERITED::drawDevice(dummy1, dummy2, x, y, dummy3); | 152 INHERITED::drawDevice(dummy1, dummy2, x, y, dummy3); |
156 after(); | 153 after(); |
157 } | 154 } |
158 | 155 |
159 private: | 156 private: |
160 void before() { | 157 void before() { |
161 if (fTracker) { | 158 if (fTracker) { |
162 fTracker->before(accessBitmap(false)); | 159 fTracker->before(accessBitmap(false)); |
163 } | 160 } |
164 } | 161 } |
165 | 162 |
166 // any/all of the expected touched has to be changed, and all expected untou
ched must be intact | 163 // any/all of the expected touched has to be changed, and all expected untou
ched must be intact |
167 void after() { | 164 void after() { |
168 if (fTracker) { | 165 if (fTracker) { |
169 fTracker->after(accessBitmap(false)); | 166 fTracker->after(accessBitmap(false)); |
170 } | 167 } |
171 } | 168 } |
172 | 169 |
173 private: | 170 private: |
174 SkTracker* fTracker; | 171 SkTracker* fTracker; |
175 | 172 |
176 typedef SkBitmapDevice INHERITED; | 173 typedef SkBitmapDevice INHERITED; |
177 }; | 174 }; |
178 | 175 |
179 #endif // SkTrackDevice_DEFINED | 176 #endif // SkTrackDevice_DEFINED |
OLD | NEW |