| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 * be freed. | 124 * be freed. |
| 125 * @return number of bytes actually freed. | 125 * @return number of bytes actually freed. |
| 126 */ | 126 */ |
| 127 size_t freeMemoryIfPossible(size_t bytesToFree); | 127 size_t freeMemoryIfPossible(size_t bytesToFree); |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * Specifies the maximum size (in bytes) allowed for a given image to be | 130 * Specifies the maximum size (in bytes) allowed for a given image to be |
| 131 * rendered using the deferred canvas. | 131 * rendered using the deferred canvas. |
| 132 */ | 132 */ |
| 133 void setBitmapSizeThreshold(size_t sizeThreshold); | 133 void setBitmapSizeThreshold(size_t sizeThreshold); |
| 134 size_t getBitmapSizeThreshold() const { return fBitmapSizeThreshold; } |
| 134 | 135 |
| 135 /** | 136 /** |
| 136 * Executes all pending commands without drawing | 137 * Executes all pending commands without drawing |
| 137 */ | 138 */ |
| 138 void silentFlush(); | 139 void silentFlush(); |
| 139 | 140 |
| 140 // Overrides of the SkCanvas interface | 141 // Overrides of the SkCanvas interface |
| 141 virtual bool isDrawingToLayer() const SK_OVERRIDE; | 142 virtual bool isDrawingToLayer() const SK_OVERRIDE; |
| 142 virtual void clear(SkColor) SK_OVERRIDE; | 143 virtual void clear(SkColor) SK_OVERRIDE; |
| 143 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; | 144 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 234 |
| 234 private: | 235 private: |
| 235 SkDeferredCanvas(SkDeferredDevice*); | 236 SkDeferredCanvas(SkDeferredDevice*); |
| 236 | 237 |
| 237 void recordedDrawCommand(); | 238 void recordedDrawCommand(); |
| 238 SkCanvas* drawingCanvas() const; | 239 SkCanvas* drawingCanvas() const; |
| 239 SkCanvas* immediateCanvas() const; | 240 SkCanvas* immediateCanvas() const; |
| 240 bool isFullFrame(const SkRect*, const SkPaint*) const; | 241 bool isFullFrame(const SkRect*, const SkPaint*) const; |
| 241 void validate() const; | 242 void validate() const; |
| 242 void init(); | 243 void init(); |
| 243 bool fDeferredDrawing; | 244 |
| 245 size_t fBitmapSizeThreshold; |
| 246 bool fDeferredDrawing; |
| 244 | 247 |
| 245 friend class SkDeferredCanvasTester; // for unit testing | 248 friend class SkDeferredCanvasTester; // for unit testing |
| 246 typedef SkCanvas INHERITED; | 249 typedef SkCanvas INHERITED; |
| 247 }; | 250 }; |
| 248 | 251 |
| 249 | 252 |
| 250 #endif | 253 #endif |
| OLD | NEW |