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 |
| 11 #include "SkAtomics.h" |
11 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
12 #include "SkDynamicAnnotations.h" | 13 #include "SkImageInfo.h" |
13 #include "SkMutex.h" | 14 #include "SkMutex.h" |
14 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
| 16 #include "SkSize.h" |
15 #include "SkString.h" | 17 #include "SkString.h" |
16 #include "SkImageInfo.h" | |
17 #include "SkSize.h" | |
18 #include "SkTDArray.h" | 18 #include "SkTDArray.h" |
19 | 19 |
20 //#define xed | 20 //#define xed |
21 | 21 |
22 #ifdef SK_DEBUG | 22 #ifdef SK_DEBUG |
23 /** | 23 /** |
24 * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref | 24 * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref |
25 * subclasses to correctly handle lock/unlock pixels. For performance | 25 * subclasses to correctly handle lock/unlock pixels. For performance |
26 * reasons, simple malloc-based subclasses call setPreLocked() to skip | 26 * reasons, simple malloc-based subclasses call setPreLocked() to skip |
27 * the overhead of implementing these calls. | 27 * the overhead of implementing these calls. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 private: | 306 private: |
307 SkBaseMutex* fMutex; // must remain in scope for the life of this object | 307 SkBaseMutex* fMutex; // must remain in scope for the life of this object |
308 | 308 |
309 // mostly const. fInfo.fAlpahType can be changed at runtime. | 309 // mostly const. fInfo.fAlpahType can be changed at runtime. |
310 const SkImageInfo fInfo; | 310 const SkImageInfo fInfo; |
311 | 311 |
312 // LockRec is only valid if we're in a locked state (isLocked()) | 312 // LockRec is only valid if we're in a locked state (isLocked()) |
313 LockRec fRec; | 313 LockRec fRec; |
314 int fLockCount; | 314 int fLockCount; |
315 | 315 |
316 mutable SkTRacy<uint32_t> fGenerationID; | 316 mutable SkAtomic<uint32_t> fGenerationID; |
317 mutable SkTRacy<bool> fUniqueGenerationID; | 317 mutable SkAtomic<bool> fUniqueGenerationID; |
318 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 318 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
319 const uint32_t fStableID; | 319 const uint32_t fStableID; |
320 #endif | 320 #endif |
321 | 321 |
322 SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owne
d | 322 SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owne
d |
323 | 323 |
324 SkString fURI; | 324 SkString fURI; |
325 | 325 |
326 // can go from false to true, but never from true to false | 326 // can go from false to true, but never from true to false |
327 bool fIsImmutable; | 327 bool fIsImmutable; |
(...skipping 18 matching lines...) Expand all Loading... |
346 /** | 346 /** |
347 * Allocate a new pixelref matching the specified ImageInfo, allocating | 347 * Allocate a new pixelref matching the specified ImageInfo, allocating |
348 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 348 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
349 * the pixelref will ref() the colortable. | 349 * the pixelref will ref() the colortable. |
350 * On failure return NULL. | 350 * On failure return NULL. |
351 */ | 351 */ |
352 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable
*) = 0; | 352 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable
*) = 0; |
353 }; | 353 }; |
354 | 354 |
355 #endif | 355 #endif |
OLD | NEW |