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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 * modifications will be lost when unlockPixels() is called.) | 120 * modifications will be lost when unlockPixels() is called.) |
121 */ | 121 */ |
122 bool lockPixelsAreWritable() const; | 122 bool lockPixelsAreWritable() const; |
123 | 123 |
124 /** Returns a non-zero, unique value corresponding to the pixels in this | 124 /** Returns a non-zero, unique value corresponding to the pixels in this |
125 pixelref. Each time the pixels are changed (and notifyPixelsChanged is | 125 pixelref. Each time the pixels are changed (and notifyPixelsChanged is |
126 called), a different generation ID will be returned. | 126 called), a different generation ID will be returned. |
127 */ | 127 */ |
128 uint32_t getGenerationID() const; | 128 uint32_t getGenerationID() const; |
129 | 129 |
130 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | |
131 /** Returns a non-zero, unique value corresponding to this SkPixelRef, | |
132 which is unchanged when the pixels are changed and even when this | |
133 object is deleted. | |
134 | |
135 Can be used as a key which must remain unique across changes and | |
136 deletions. | |
137 */ | |
138 uint32_t getStableID() const; | |
139 #endif | |
140 | |
130 /** | 141 /** |
131 * Call this if you have changed the contents of the pixels. This will in- | 142 * 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 | 143 * turn cause a different generation ID value to be returned from |
133 * getGenerationID(). | 144 * getGenerationID(). |
134 */ | 145 */ |
135 void notifyPixelsChanged(); | 146 void notifyPixelsChanged(); |
136 | 147 |
137 /** | 148 /** |
138 * Change the info's AlphaType. Note that this does not automatically | 149 * Change the info's AlphaType. Note that this does not automatically |
139 * invalidate the generation ID. If the pixel values themselves have | 150 * invalidate the generation ID. If the pixel values themselves have |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 | 362 |
352 // mostly const. fInfo.fAlpahType can be changed at runtime. | 363 // mostly const. fInfo.fAlpahType can be changed at runtime. |
353 const SkImageInfo fInfo; | 364 const SkImageInfo fInfo; |
354 | 365 |
355 // LockRec is only valid if we're in a locked state (isLocked()) | 366 // LockRec is only valid if we're in a locked state (isLocked()) |
356 LockRec fRec; | 367 LockRec fRec; |
357 int fLockCount; | 368 int fLockCount; |
358 | 369 |
359 mutable SkTRacy<uint32_t> fGenerationID; | 370 mutable SkTRacy<uint32_t> fGenerationID; |
360 mutable SkTRacy<bool> fUniqueGenerationID; | 371 mutable SkTRacy<bool> fUniqueGenerationID; |
372 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | |
373 mutable SkTRacy<uint32_t> fStableID; | |
mtklein
2014/11/24 19:12:41
const uint32_t and fill it in the constructor? It
scroggo
2014/11/24 19:20:25
Done.
| |
374 #endif | |
361 | 375 |
362 SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owne d | 376 SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owne d |
363 | 377 |
364 SkString fURI; | 378 SkString fURI; |
365 | 379 |
366 // can go from false to true, but never from true to false | 380 // can go from false to true, but never from true to false |
367 bool fIsImmutable; | 381 bool fIsImmutable; |
368 // only ever set in constructor, const after that | 382 // only ever set in constructor, const after that |
369 bool fPreLocked; | 383 bool fPreLocked; |
370 | 384 |
(...skipping 15 matching lines...) Expand all Loading... | |
386 /** | 400 /** |
387 * Allocate a new pixelref matching the specified ImageInfo, allocating | 401 * Allocate a new pixelref matching the specified ImageInfo, allocating |
388 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 402 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
389 * the pixelref will ref() the colortable. | 403 * the pixelref will ref() the colortable. |
390 * On failure return NULL. | 404 * On failure return NULL. |
391 */ | 405 */ |
392 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; | 406 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable *) = 0; |
393 }; | 407 }; |
394 | 408 |
395 #endif | 409 #endif |
OLD | NEW |