| 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 DeferredDevice; |
| 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. |
| 25 */ | 25 */ |
| 26 class SK_API SkDeferredCanvas : public SkCanvas { | 26 class SK_API SkDeferredCanvas : public SkCanvas { |
| 27 public: | 27 public: |
| 28 class NotificationClient; | 28 class SK_API NotificationClient; |
| 29 | 29 |
| 30 /** Construct a canvas with the specified surface to draw into. | 30 /** Construct a canvas with the specified surface to draw into. |
| 31 This factory must be used for newImageSnapshot to work. | 31 This factory must be used for newImageSnapshot to work. |
| 32 @param surface Specifies a surface for the canvas to draw into. | 32 @param surface Specifies a surface for the canvas to draw into. |
| 33 */ | 33 */ |
| 34 static SkDeferredCanvas* Create(SkSurface* surface); | 34 static SkDeferredCanvas* Create(SkSurface* surface); |
| 35 | 35 |
| 36 static SkDeferredCanvas* Create(SkBaseDevice* device); | 36 static SkDeferredCanvas* Create(SkBaseDevice* device); |
| 37 | 37 |
| 38 virtual ~SkDeferredCanvas(); | 38 virtual ~SkDeferredCanvas(); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 void validate() const; | 247 void validate() const; |
| 248 void init(); | 248 void init(); |
| 249 bool fDeferredDrawing; | 249 bool fDeferredDrawing; |
| 250 | 250 |
| 251 friend class SkDeferredCanvasTester; // for unit testing | 251 friend class SkDeferredCanvasTester; // for unit testing |
| 252 typedef SkCanvas INHERITED; | 252 typedef SkCanvas INHERITED; |
| 253 }; | 253 }; |
| 254 | 254 |
| 255 | 255 |
| 256 #endif | 256 #endif |
| OLD | NEW |