OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 SkDeferredCanvas_DEFINED | 8 #ifndef SkDeferredCanvas_DEFINED |
9 #define SkDeferredCanvas_DEFINED | 9 #define SkDeferredCanvas_DEFINED |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 * rendered using the deferred canvas. | 136 * rendered using the deferred canvas. |
137 */ | 137 */ |
138 void setBitmapSizeThreshold(size_t sizeThreshold); | 138 void setBitmapSizeThreshold(size_t sizeThreshold); |
139 size_t getBitmapSizeThreshold() const { return fBitmapSizeThreshold; } | 139 size_t getBitmapSizeThreshold() const { return fBitmapSizeThreshold; } |
140 | 140 |
141 /** | 141 /** |
142 * Executes all pending commands without drawing | 142 * Executes all pending commands without drawing |
143 */ | 143 */ |
144 void silentFlush(); | 144 void silentFlush(); |
145 | 145 |
146 SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE; | 146 SkDrawFilter* setDrawFilter(SkDrawFilter* filter) override; |
147 | 147 |
148 protected: | 148 protected: |
149 void willSave() SK_OVERRIDE; | 149 void willSave() override; |
150 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK
_OVERRIDE; | 150 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) ov
erride; |
151 void willRestore() SK_OVERRIDE; | 151 void willRestore() override; |
152 | 152 |
153 void didConcat(const SkMatrix&) SK_OVERRIDE; | 153 void didConcat(const SkMatrix&) override; |
154 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 154 void didSetMatrix(const SkMatrix&) override; |
155 | 155 |
156 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; | 156 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
157 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, | 157 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, |
158 const SkPaint&) SK_OVERRIDE; | 158 const SkPaint&) override; |
159 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], | 159 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], |
160 const SkPaint&) SK_OVERRIDE; | 160 const SkPaint&) override; |
161 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], | 161 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], |
162 SkScalar constY, const SkPaint&) SK_OVERRIDE; | 162 SkScalar constY, const SkPaint&) override; |
163 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 163 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
164 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; | 164 const SkMatrix* matrix, const SkPaint&) overri
de; |
165 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 165 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
166 const SkPaint& paint) SK_OVERRIDE; | 166 const SkPaint& paint) override; |
167 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], | 167 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
168 const SkPoint texCoords[4], SkXfermode* xmode, | 168 const SkPoint texCoords[4], SkXfermode* xmode, |
169 const SkPaint& paint) SK_OVERRIDE; | 169 const SkPaint& paint) override; |
170 | 170 |
171 void onDrawPaint(const SkPaint&) SK_OVERRIDE; | 171 void onDrawPaint(const SkPaint&) override; |
172 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) SK_OVERRIDE; | 172 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) override; |
173 void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; | 173 void onDrawRect(const SkRect&, const SkPaint&) override; |
174 void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | 174 void onDrawOval(const SkRect&, const SkPaint&) override; |
175 void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | 175 void onDrawRRect(const SkRRect&, const SkPaint&) override; |
176 void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE; | 176 void onDrawPath(const SkPath&, const SkPaint&) override; |
177 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) SK_OVERRIDE; | 177 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override; |
178 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, | 178 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, |
179 DrawBitmapRectFlags flags) SK_OVERRIDE; | 179 DrawBitmapRectFlags flags) override; |
180 #if 0 | 180 #if 0 |
181 // rely on conversion to bitmap(for now) | 181 // rely on conversion to bitmap(for now) |
182 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) SK_OVERRIDE; | 182 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) override; |
183 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, | 183 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
184 const SkPaint*) SK_OVERRIDE; | 184 const SkPaint*) override; |
185 #endif | 185 #endif |
186 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, | 186 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, |
187 const SkPaint*) SK_OVERRIDE; | 187 const SkPaint*) override; |
188 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; | 188 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) overri
de; |
189 void onDrawVertices(VertexMode vmode, int vertexCount, | 189 void onDrawVertices(VertexMode vmode, int vertexCount, |
190 const SkPoint vertices[], const SkPoint texs[], | 190 const SkPoint vertices[], const SkPoint texs[], |
191 const SkColor colors[], SkXfermode* xmode, | 191 const SkColor colors[], SkXfermode* xmode, |
192 const uint16_t indices[], int indexCount, | 192 const uint16_t indices[], int indexCount, |
193 const SkPaint&) SK_OVERRIDE; | 193 const SkPaint&) override; |
194 | 194 |
195 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 195 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
196 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 196 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
197 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 197 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
198 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 198 void onClipRegion(const SkRegion&, SkRegion::Op) override; |
199 | 199 |
200 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE; | 200 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; |
201 | 201 |
202 public: | 202 public: |
203 class NotificationClient { | 203 class NotificationClient { |
204 public: | 204 public: |
205 virtual ~NotificationClient() {} | 205 virtual ~NotificationClient() {} |
206 | 206 |
207 /** | 207 /** |
208 * Called before executing one or several draw commands, which means | 208 * Called before executing one or several draw commands, which means |
209 * once per flush when deferred rendering is enabled. | 209 * once per flush when deferred rendering is enabled. |
210 */ | 210 */ |
(...skipping 14 matching lines...) Expand all Loading... |
225 | 225 |
226 /** | 226 /** |
227 * Called after pending draw commands have been skipped, meaning | 227 * Called after pending draw commands have been skipped, meaning |
228 * that they were optimized-out because the canvas is cleared | 228 * that they were optimized-out because the canvas is cleared |
229 * or completely overwritten by the command currently being recorded. | 229 * or completely overwritten by the command currently being recorded. |
230 */ | 230 */ |
231 virtual void skippedPendingDrawCommands() {} | 231 virtual void skippedPendingDrawCommands() {} |
232 }; | 232 }; |
233 | 233 |
234 protected: | 234 protected: |
235 SkCanvas* canvasForDrawIter() SK_OVERRIDE; | 235 SkCanvas* canvasForDrawIter() override; |
236 SkDeferredDevice* getDeferredDevice() const; | 236 SkDeferredDevice* getDeferredDevice() const; |
237 | 237 |
238 private: | 238 private: |
239 SkDeferredCanvas(SkDeferredDevice*); | 239 SkDeferredCanvas(SkDeferredDevice*); |
240 | 240 |
241 void recordedDrawCommand(); | 241 void recordedDrawCommand(); |
242 SkCanvas* drawingCanvas() const; | 242 SkCanvas* drawingCanvas() const; |
243 SkCanvas* immediateCanvas() const; | 243 SkCanvas* immediateCanvas() const; |
244 bool isFullFrame(const SkRect*, const SkPaint*) const; | 244 bool isFullFrame(const SkRect*, const SkPaint*) const; |
245 void validate() const; | 245 void validate() const; |
246 void init(); | 246 void init(); |
247 | 247 |
248 | 248 |
249 int fSaveLevel; | 249 int fSaveLevel; |
250 int fFirstSaveLayerIndex; | 250 int fFirstSaveLayerIndex; |
251 size_t fBitmapSizeThreshold; | 251 size_t fBitmapSizeThreshold; |
252 bool fDeferredDrawing; | 252 bool fDeferredDrawing; |
253 | 253 |
254 mutable SkISize fCachedCanvasSize; | 254 mutable SkISize fCachedCanvasSize; |
255 mutable bool fCachedCanvasSizeDirty; | 255 mutable bool fCachedCanvasSizeDirty; |
256 | 256 |
257 friend class SkDeferredCanvasTester; // for unit testing | 257 friend class SkDeferredCanvasTester; // for unit testing |
258 typedef SkCanvas INHERITED; | 258 typedef SkCanvas INHERITED; |
259 }; | 259 }; |
260 | 260 |
261 | 261 |
262 #endif | 262 #endif |
OLD | NEW |