| 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 |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkPixelRef.h" | 12 #include "SkPixelRef.h" |
| 13 | 13 |
| 14 class DeferredDevice; | 14 class SkDeferredDevice; |
| 15 class SkImage; | 15 class SkImage; |
| 16 class SkSurface; | 16 class SkSurface; |
| 17 | 17 |
| 18 /** \class SkDeferredCanvas | 18 /** \class SkDeferredCanvas |
| 19 Subclass of SkCanvas that encapsulates an SkPicture or SkGPipe for deferred | 19 Subclass of SkCanvas that encapsulates an SkPicture or SkGPipe for deferred |
| 20 drawing. The main difference between this class and SkPictureRecord (the | 20 drawing. The main difference between this class and SkPictureRecord (the |
| 21 canvas provided by SkPicture) is that this is a full drop-in replacement | 21 canvas provided by SkPicture) is that this is a full drop-in replacement |
| 22 for SkCanvas, while SkPictureRecord only supports draw operations. | 22 for SkCanvas, while SkPictureRecord only supports draw operations. |
| 23 SkDeferredCanvas will transparently trigger the flushing of deferred | 23 SkDeferredCanvas will transparently trigger the flushing of deferred |
| 24 draw operations when an attempt is made to access the pixel data. | 24 draw operations when an attempt is made to access the pixel data. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 /** | 229 /** |
| 230 * Called after pending draw commands have been skipped, meaning | 230 * Called after pending draw commands have been skipped, meaning |
| 231 * that they were optimized-out because the canvas is cleared | 231 * that they were optimized-out because the canvas is cleared |
| 232 * or completely overwritten by the command currently being recorded. | 232 * or completely overwritten by the command currently being recorded. |
| 233 */ | 233 */ |
| 234 virtual void skippedPendingDrawCommands() {} | 234 virtual void skippedPendingDrawCommands() {} |
| 235 }; | 235 }; |
| 236 | 236 |
| 237 protected: | 237 protected: |
| 238 virtual SkCanvas* canvasForDrawIter(); | 238 virtual SkCanvas* canvasForDrawIter(); |
| 239 DeferredDevice* getDeferredDevice() const; | 239 SkDeferredDevice* getDeferredDevice() const; |
| 240 | 240 |
| 241 private: | 241 private: |
| 242 SkDeferredCanvas(DeferredDevice*); | 242 SkDeferredCanvas(SkDeferredDevice*); |
| 243 | 243 |
| 244 void recordedDrawCommand(); | 244 void recordedDrawCommand(); |
| 245 SkCanvas* drawingCanvas() const; | 245 SkCanvas* drawingCanvas() const; |
| 246 SkCanvas* immediateCanvas() const; | 246 SkCanvas* immediateCanvas() const; |
| 247 bool isFullFrame(const SkRect*, const SkPaint*) const; | 247 bool isFullFrame(const SkRect*, const SkPaint*) const; |
| 248 void validate() const; | 248 void validate() const; |
| 249 void init(); | 249 void init(); |
| 250 bool fDeferredDrawing; | 250 bool fDeferredDrawing; |
| 251 | 251 |
| 252 friend class SkDeferredCanvasTester; // for unit testing | 252 friend class SkDeferredCanvasTester; // for unit testing |
| 253 typedef SkCanvas INHERITED; | 253 typedef SkCanvas INHERITED; |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 | 256 |
| 257 #endif | 257 #endif |
| OLD | NEW |