OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 SkPixelRef_DEFINED | 8 #ifndef SkPixelRef_DEFINED |
9 #define SkPixelRef_DEFINED | 9 #define SkPixelRef_DEFINED |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 /** Returns a non-zero, unique value corresponding to the pixels in this | 123 /** Returns a non-zero, unique value corresponding to the pixels in this |
124 pixelref. Each time the pixels are changed (and notifyPixelsChanged is | 124 pixelref. Each time the pixels are changed (and notifyPixelsChanged is |
125 called), a different generation ID will be returned. | 125 called), a different generation ID will be returned. |
126 */ | 126 */ |
127 uint32_t getGenerationID() const; | 127 uint32_t getGenerationID() const; |
128 | 128 |
129 /** | 129 /** |
130 * Call this if you have changed the contents of the pixels. This will in- | 130 * Call this if you have changed the contents of the pixels. This will in- |
131 * turn cause a different generation ID value to be returned from | 131 * turn cause a different generation ID value to be returned from |
132 * getGenerationID(). | 132 * getGenerationID(). |
133 * | |
134 * If the alphatype has also changed, specify its new value as well. If | |
135 * the new pixels' alphatype is the same, this can be called with no | |
136 * parameter. | |
137 */ | 133 */ |
138 void notifyPixelsChanged(SkAlphaType); | 134 void notifyPixelsChanged(); |
139 void notifyPixelsChanged() { | 135 |
140 this->notifyPixelsChanged(fInfo.fAlphaType); | 136 /** |
141 } | 137 * Change the info's AlphaType. Note that this does not automatically |
| 138 * invalidate the generation ID. If the pixel values themselves have |
| 139 * changed, then you must explicitly call notifyPixelsChanged() as well. |
| 140 */ |
| 141 void changeAlphaType(SkAlphaType at); |
142 | 142 |
143 /** Returns true if this pixelref is marked as immutable, meaning that the | 143 /** Returns true if this pixelref is marked as immutable, meaning that the |
144 contents of its pixels will not change for the lifetime of the pixelref. | 144 contents of its pixels will not change for the lifetime of the pixelref. |
145 */ | 145 */ |
146 bool isImmutable() const { return fIsImmutable; } | 146 bool isImmutable() const { return fIsImmutable; } |
147 | 147 |
148 /** Marks this pixelref is immutable, meaning that the contents of its | 148 /** Marks this pixelref is immutable, meaning that the contents of its |
149 pixels will not change for the lifetime of the pixelref. This state can | 149 pixels will not change for the lifetime of the pixelref. This state can |
150 be set on a pixelref, but it cannot be cleared once it is set. | 150 be set on a pixelref, but it cannot be cleared once it is set. |
151 */ | 151 */ |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 /** | 376 /** |
377 * Allocate a new pixelref matching the specified ImageInfo, allocating | 377 * Allocate a new pixelref matching the specified ImageInfo, allocating |
378 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 378 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
379 * the pixelref will ref() the colortable. | 379 * the pixelref will ref() the colortable. |
380 * On failure return NULL. | 380 * On failure return NULL. |
381 */ | 381 */ |
382 virtual SkPixelRef* create(const SkImageInfo&, SkColorTable*) = 0; | 382 virtual SkPixelRef* create(const SkImageInfo&, SkColorTable*) = 0; |
383 }; | 383 }; |
384 | 384 |
385 #endif | 385 #endif |
OLD | NEW |