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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 * of the previous frame. For example, if a canvas is cleared before | 82 * of the previous frame. For example, if a canvas is cleared before |
83 * drawing each frame, the frames will all be considered fresh. | 83 * drawing each frame, the frames will all be considered fresh. |
84 * A frame is defined as the graphics image produced by as a result | 84 * A frame is defined as the graphics image produced by as a result |
85 * of all the canvas draws operation executed between two successive | 85 * of all the canvas draws operation executed between two successive |
86 * calls to isFreshFrame. The result of isFreshFrame is computed | 86 * calls to isFreshFrame. The result of isFreshFrame is computed |
87 * conservatively, so it may report false negatives. | 87 * conservatively, so it may report false negatives. |
88 */ | 88 */ |
89 bool isFreshFrame() const; | 89 bool isFreshFrame() const; |
90 | 90 |
91 /** | 91 /** |
92 * Returns canvas's size. | |
93 */ | |
94 SkISize getCanvasSize() const; | |
95 | |
96 /** | |
97 * Returns true if the canvas has recorded draw commands that have | 92 * Returns true if the canvas has recorded draw commands that have |
98 * not yet been played back. | 93 * not yet been played back. |
99 */ | 94 */ |
100 bool hasPendingCommands() const; | 95 bool hasPendingCommands() const; |
101 | 96 |
102 /** | 97 /** |
103 * Flushes pending draw commands, if any, and returns an image of the | 98 * Flushes pending draw commands, if any, and returns an image of the |
104 * current state of the surface pixels up to this point. Subsequent | 99 * current state of the surface pixels up to this point. Subsequent |
105 * changes to the surface (by drawing into its canvas) will not be | 100 * changes to the surface (by drawing into its canvas) will not be |
106 * reflected in this image. Will return NULL if the deferred canvas | 101 * reflected in this image. Will return NULL if the deferred canvas |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 void recordedDrawCommand(); | 243 void recordedDrawCommand(); |
249 SkCanvas* drawingCanvas() const; | 244 SkCanvas* drawingCanvas() const; |
250 SkCanvas* immediateCanvas() const; | 245 SkCanvas* immediateCanvas() const; |
251 bool isFullFrame(const SkRect*, const SkPaint*) const; | 246 bool isFullFrame(const SkRect*, const SkPaint*) const; |
252 void validate() const; | 247 void validate() const; |
253 void init(); | 248 void init(); |
254 | 249 |
255 size_t fBitmapSizeThreshold; | 250 size_t fBitmapSizeThreshold; |
256 bool fDeferredDrawing; | 251 bool fDeferredDrawing; |
257 | 252 |
258 mutable SkISize fCachedCanvasSize; | |
259 mutable bool fCachedCanvasSizeDirty; | |
260 | |
261 friend class SkDeferredCanvasTester; // for unit testing | 253 friend class SkDeferredCanvasTester; // for unit testing |
262 typedef SkCanvas INHERITED; | 254 typedef SkCanvas INHERITED; |
263 }; | 255 }; |
264 | 256 |
265 | 257 |
266 #endif | 258 #endif |
OLD | NEW |