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 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE; | 146 SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE; |
147 | 147 |
148 protected: | 148 protected: |
149 virtual void willSave() SK_OVERRIDE; | 149 void willSave() SK_OVERRIDE; |
150 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF
lags) SK_OVERRIDE; | 150 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK
_OVERRIDE; |
151 virtual void willRestore() SK_OVERRIDE; | 151 void willRestore() SK_OVERRIDE; |
152 | 152 |
153 virtual void didConcat(const SkMatrix&) SK_OVERRIDE; | 153 void didConcat(const SkMatrix&) SK_OVERRIDE; |
154 virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 154 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
155 | 155 |
156 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK
_OVERRIDE; | 156 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; |
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&) SK_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&) SK_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&) SK_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&) SK_OVE
RRIDE; |
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) SK_OVERRIDE; |
(...skipping 18 matching lines...) Expand all Loading... |
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*) SK_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*) SK_OVE
RRIDE; |
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&) SK_OVERRIDE; |
194 | 194 |
195 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 195 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
196 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; | 196 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
197 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 197 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
198 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 198 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; |
199 | 199 |
200 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*
) SK_OVERRIDE; | 200 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE; |
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 virtual SkCanvas* canvasForDrawIter() SK_OVERRIDE; | 235 SkCanvas* canvasForDrawIter() SK_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 |