| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 | |
| 10 #ifndef SkPixelRef_DEFINED | 8 #ifndef SkPixelRef_DEFINED |
| 11 #define SkPixelRef_DEFINED | 9 #define SkPixelRef_DEFINED |
| 12 | 10 |
| 13 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 14 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
| 15 #include "SkString.h" | 13 #include "SkString.h" |
| 16 #include "SkFlattenable.h" | 14 #include "SkFlattenable.h" |
| 17 #include "SkImageInfo.h" | 15 #include "SkImageInfo.h" |
| 18 #include "SkTDArray.h" | 16 #include "SkTDArray.h" |
| 19 | 17 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 called), a different generation ID will be returned. | 125 called), a different generation ID will be returned. |
| 128 */ | 126 */ |
| 129 uint32_t getGenerationID() const; | 127 uint32_t getGenerationID() const; |
| 130 | 128 |
| 131 /** Call this if you have changed the contents of the pixels. This will in- | 129 /** Call this if you have changed the contents of the pixels. This will in- |
| 132 turn cause a different generation ID value to be returned from | 130 turn cause a different generation ID value to be returned from |
| 133 getGenerationID(). | 131 getGenerationID(). |
| 134 */ | 132 */ |
| 135 void notifyPixelsChanged(); | 133 void notifyPixelsChanged(); |
| 136 | 134 |
| 135 /** |
| 136 * Call if the pixels have changed such that they need a new alphaType. |
| 137 * e.g. Now the pixels are all opaque (or are no longer all opaque). |
| 138 * |
| 139 * Calling this, if the specified alphatype difference from the current |
| 140 * type, will automatically invalidate the generationID. |
| 141 */ |
| 142 void notifyAlphaTypeChanged(SkAlphaType); |
| 143 |
| 137 /** Returns true if this pixelref is marked as immutable, meaning that the | 144 /** Returns true if this pixelref is marked as immutable, meaning that the |
| 138 contents of its pixels will not change for the lifetime of the pixelref. | 145 contents of its pixels will not change for the lifetime of the pixelref. |
| 139 */ | 146 */ |
| 140 bool isImmutable() const { return fIsImmutable; } | 147 bool isImmutable() const { return fIsImmutable; } |
| 141 | 148 |
| 142 /** Marks this pixelref is immutable, meaning that the contents of its | 149 /** Marks this pixelref is immutable, meaning that the contents of its |
| 143 pixels will not change for the lifetime of the pixelref. This state can | 150 pixels will not change for the lifetime of the pixelref. This state can |
| 144 be set on a pixelref, but it cannot be cleared once it is set. | 151 be set on a pixelref, but it cannot be cleared once it is set. |
| 145 */ | 152 */ |
| 146 void setImmutable(); | 153 void setImmutable(); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 /** | 376 /** |
| 370 * Allocate a new pixelref matching the specified ImageInfo, allocating | 377 * Allocate a new pixelref matching the specified ImageInfo, allocating |
| 371 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 378 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
| 372 * the pixelref will ref() the colortable. | 379 * the pixelref will ref() the colortable. |
| 373 * On failure return NULL. | 380 * On failure return NULL. |
| 374 */ | 381 */ |
| 375 virtual SkPixelRef* create(const SkImageInfo&, SkColorTable*) = 0; | 382 virtual SkPixelRef* create(const SkImageInfo&, SkColorTable*) = 0; |
| 376 }; | 383 }; |
| 377 | 384 |
| 378 #endif | 385 #endif |
| OLD | NEW |