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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 * | 51 * |
52 * The default implementation does nothing. | 52 * The default implementation does nothing. |
53 */ | 53 */ |
54 virtual void onCopyOnWrite(SkImage* cachedImage, SkCanvas*) = 0; | 54 virtual void onCopyOnWrite() = 0; |
55 | 55 |
56 inline SkCanvas* getCachedCanvas(); | 56 inline SkCanvas* getCachedCanvas(); |
57 inline SkImage* getCachedImage(); | 57 inline SkImage* getCachedImage(); |
58 | 58 |
59 // called by SkSurface to compute a new genID | 59 // called by SkSurface to compute a new genID |
60 uint32_t newGenerationID(); | 60 uint32_t newGenerationID(); |
61 | 61 |
62 private: | 62 private: |
63 SkCanvas* fCachedCanvas; | 63 SkCanvas* fCachedCanvas; |
64 SkImage* fCachedImage; | 64 SkImage* fCachedImage; |
65 | 65 |
66 void aboutToDraw(SkCanvas*); | 66 void aboutToDraw(); |
67 friend class SkCanvas; | 67 friend class SkCanvas; |
68 friend class SkSurface; | 68 friend class SkSurface; |
69 | 69 |
70 inline void installIntoCanvasForDirtyNotification(); | 70 inline void installIntoCanvasForDirtyNotification(); |
71 | 71 |
72 typedef SkSurface INHERITED; | 72 typedef SkSurface INHERITED; |
73 }; | 73 }; |
74 | 74 |
75 #endif | 75 #endif |
OLD | NEW |