| 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_DEFINED | 8 #ifndef SkSurface_DEFINED |
| 9 #define SkSurface_DEFINED | 9 #define SkSurface_DEFINED |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 * surface. Each time the content is changed changed, either by drawing | 72 * surface. Each time the content is changed changed, either by drawing |
| 73 * into this surface, or explicitly calling notifyContentChanged()) this | 73 * into this surface, or explicitly calling notifyContentChanged()) this |
| 74 * method will return a new value. | 74 * method will return a new value. |
| 75 * | 75 * |
| 76 * If this surface is empty (i.e. has a zero-dimention), this will return | 76 * If this surface is empty (i.e. has a zero-dimention), this will return |
| 77 * 0. | 77 * 0. |
| 78 */ | 78 */ |
| 79 uint32_t generationID(); | 79 uint32_t generationID(); |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * Call this if the contents have changed. This will (lazily) force a new | 82 * Modes that can be passed to notifyContentWillChange |
| 83 */ |
| 84 enum ContentChangeMode { |
| 85 /** |
| 86 * Use this mode if it is known that the upcoming content changes will |
| 87 * clear or overwrite prior contents, thus making them discardable. |
| 88 */ |
| 89 kDiscard_ContentChangeMode, |
| 90 /** |
| 91 * Use this mode if prior surface contents need to be preserved or |
| 92 * if in doubt. |
| 93 */ |
| 94 kRetain_ContentChangeMode, |
| 95 }; |
| 96 |
| 97 /** |
| 98 * Call this if the contents are about to change. This will (lazily) force
a new |
| 83 * value to be returned from generationID() when it is called next. | 99 * value to be returned from generationID() when it is called next. |
| 84 */ | 100 */ |
| 85 void notifyContentChanged(); | 101 void notifyContentWillChange(ContentChangeMode mode); |
| 86 | 102 |
| 87 /** | 103 /** |
| 88 * Return a canvas that will draw into this surface. This will always | 104 * Return a canvas that will draw into this surface. This will always |
| 89 * return the same canvas for a given surface, and is manged/owned by the | 105 * return the same canvas for a given surface, and is manged/owned by the |
| 90 * surface. It should not be used when its parent surface has gone out of | 106 * surface. It should not be used when its parent surface has gone out of |
| 91 * scope. | 107 * scope. |
| 92 */ | 108 */ |
| 93 SkCanvas* getCanvas(); | 109 SkCanvas* getCanvas(); |
| 94 | 110 |
| 95 /** | 111 /** |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 149 |
| 134 private: | 150 private: |
| 135 const int fWidth; | 151 const int fWidth; |
| 136 const int fHeight; | 152 const int fHeight; |
| 137 uint32_t fGenerationID; | 153 uint32_t fGenerationID; |
| 138 | 154 |
| 139 typedef SkRefCnt INHERITED; | 155 typedef SkRefCnt INHERITED; |
| 140 }; | 156 }; |
| 141 | 157 |
| 142 #endif | 158 #endif |
| OLD | NEW |