OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkColorTable_DEFINED | 10 #ifndef SkColorTable_DEFINED |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 /** Similar to lockColors(), lock16BitCache() returns the array of | 58 /** Similar to lockColors(), lock16BitCache() returns the array of |
59 RGB16 colors that mirror the 32bit colors. However, this function | 59 RGB16 colors that mirror the 32bit colors. However, this function |
60 will return null if kColorsAreOpaque_Flag is not set. | 60 will return null if kColorsAreOpaque_Flag is not set. |
61 Also, unlike lockColors(), the returned array here cannot be modified. | 61 Also, unlike lockColors(), the returned array here cannot be modified. |
62 */ | 62 */ |
63 const uint16_t* lock16BitCache(); | 63 const uint16_t* lock16BitCache(); |
64 /** Balancing call to lock16BitCache(). | 64 /** Balancing call to lock16BitCache(). |
65 */ | 65 */ |
66 void unlock16BitCache() { | 66 void unlock16BitCache() { |
67 SkASSERT(f16BitCacheLockCount > 0); | 67 SkASSERT(f16BitCacheLockCount > 0); |
68 SkDEBUGCODE(f16BitCacheLockCount -= 1); | 68 SkDEBUGCODE(sk_atomic_dec(&f16BitCacheLockCount);) |
69 } | 69 } |
70 | 70 |
71 explicit SkColorTable(SkReadBuffer&); | 71 explicit SkColorTable(SkReadBuffer&); |
72 void writeToBuffer(SkWriteBuffer&) const; | 72 void writeToBuffer(SkWriteBuffer&) const; |
73 | 73 |
74 private: | 74 private: |
75 SkPMColor* fColors; | 75 SkPMColor* fColors; |
76 uint16_t* f16BitCache; | 76 uint16_t* f16BitCache; |
77 int fCount; | 77 int fCount; |
78 SkDEBUGCODE(int fColorLockCount;) | 78 SkDEBUGCODE(int fColorLockCount;) |
79 SkDEBUGCODE(int f16BitCacheLockCount;) | 79 SkDEBUGCODE(int f16BitCacheLockCount;) |
80 | 80 |
81 void init(const SkPMColor* colors, int count); | 81 void init(const SkPMColor* colors, int count); |
82 | 82 |
83 void inval16BitCache(); | 83 void inval16BitCache(); |
84 | 84 |
85 typedef SkRefCnt INHERITED; | 85 typedef SkRefCnt INHERITED; |
86 }; | 86 }; |
87 | 87 |
88 #endif | 88 #endif |
OLD | NEW |