| 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 SkSurface_Base_DEFINED | 8 #ifndef SkSurface_Base_DEFINED |
| 9 #define SkSurface_Base_DEFINED | 9 #define SkSurface_Base_DEFINED |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 * image->draw(canvas, ...); | 41 * image->draw(canvas, ...); |
| 42 * image->unref(); | 42 * image->unref(); |
| 43 * } | 43 * } |
| 44 */ | 44 */ |
| 45 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); | 45 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * If the surface is about to change, we call this so that our subclass | 48 * If the surface is about to change, we call this so that our subclass |
| 49 * can optionally fork their backend (copy-on-write) in case it was | 49 * can optionally fork their backend (copy-on-write) in case it was |
| 50 * being shared with the cachedImage. | 50 * being shared with the cachedImage. |
| 51 * | |
| 52 * The default implementation does nothing. | |
| 53 */ | 51 */ |
| 54 virtual void onCopyOnWrite() = 0; | 52 virtual void onCopyOnWrite(ContentChangeMode) = 0; |
| 55 | 53 |
| 56 inline SkCanvas* getCachedCanvas(); | 54 inline SkCanvas* getCachedCanvas(); |
| 57 inline SkImage* getCachedImage(); | 55 inline SkImage* getCachedImage(); |
| 58 | 56 |
| 59 // called by SkSurface to compute a new genID | 57 // called by SkSurface to compute a new genID |
| 60 uint32_t newGenerationID(); | 58 uint32_t newGenerationID(); |
| 61 | 59 |
| 62 private: | 60 private: |
| 63 SkCanvas* fCachedCanvas; | 61 SkCanvas* fCachedCanvas; |
| 64 SkImage* fCachedImage; | 62 SkImage* fCachedImage; |
| 65 | 63 |
| 66 void aboutToDraw(); | 64 void aboutToDraw(ContentChangeMode mode); |
| 67 friend class SkCanvas; | 65 friend class SkCanvas; |
| 68 friend class SkSurface; | 66 friend class SkSurface; |
| 69 | 67 |
| 70 inline void installIntoCanvasForDirtyNotification(); | 68 inline void installIntoCanvasForDirtyNotification(); |
| 71 | 69 |
| 72 typedef SkSurface INHERITED; | 70 typedef SkSurface INHERITED; |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 #endif | 73 #endif |
| OLD | NEW |