| 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 |
| 11 #define SkColorTable_DEFINED | 11 #define SkColorTable_DEFINED |
| 12 | 12 |
| 13 #include "SkAlpha.h" | 13 #include "SkAlpha.h" |
| 14 #include "SkColor.h" | 14 #include "SkColor.h" |
| 15 #include "SkFlattenable.h" | 15 #include "SkFlattenable.h" |
| 16 | 16 |
| 17 /** \class SkColorTable | 17 /** \class SkColorTable |
| 18 | 18 |
| 19 SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by | 19 SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by |
| 20 8-bit bitmaps, where the bitmap bytes are interpreted as indices into the co
lortable. | 20 8-bit bitmaps, where the bitmap bytes are interpreted as indices into the co
lortable. |
| 21 */ | 21 */ |
| 22 class SkColorTable : public SkFlattenable { | 22 class SkColorTable : public SkRefCnt { |
| 23 public: | 23 public: |
| 24 SK_DECLARE_INST_COUNT(SkColorTable) | 24 SK_DECLARE_INST_COUNT(SkColorTable) |
| 25 | 25 |
| 26 /** Makes a deep copy of colors. | 26 /** Makes a deep copy of colors. |
| 27 */ | 27 */ |
| 28 SkColorTable(const SkColorTable& src); | 28 SkColorTable(const SkColorTable& src); |
| 29 SkColorTable(const SkPMColor colors[], int count, | 29 SkColorTable(const SkPMColor colors[], int count, |
| 30 SkAlphaType alphaType = kPremul_SkAlphaType); | 30 SkAlphaType alphaType = kPremul_SkAlphaType); |
| 31 virtual ~SkColorTable(); | 31 virtual ~SkColorTable(); |
| 32 | 32 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 Also, unlike lockColors(), the returned array here cannot be modified. | 68 Also, unlike lockColors(), the returned array here cannot be modified. |
| 69 */ | 69 */ |
| 70 const uint16_t* lock16BitCache(); | 70 const uint16_t* lock16BitCache(); |
| 71 /** Balancing call to lock16BitCache(). | 71 /** Balancing call to lock16BitCache(). |
| 72 */ | 72 */ |
| 73 void unlock16BitCache() { | 73 void unlock16BitCache() { |
| 74 SkASSERT(f16BitCacheLockCount > 0); | 74 SkASSERT(f16BitCacheLockCount > 0); |
| 75 SkDEBUGCODE(f16BitCacheLockCount -= 1); | 75 SkDEBUGCODE(f16BitCacheLockCount -= 1); |
| 76 } | 76 } |
| 77 | 77 |
| 78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorTable) | |
| 79 | |
| 80 protected: | |
| 81 explicit SkColorTable(SkFlattenableReadBuffer&); | 78 explicit SkColorTable(SkFlattenableReadBuffer&); |
| 82 void flatten(SkFlattenableWriteBuffer&) const; | 79 void writeToBuffer(SkFlattenableWriteBuffer&) const; |
| 83 | 80 |
| 84 private: | 81 private: |
| 85 SkPMColor* fColors; | 82 SkPMColor* fColors; |
| 86 uint16_t* f16BitCache; | 83 uint16_t* f16BitCache; |
| 87 uint16_t fCount; | 84 uint16_t fCount; |
| 88 uint8_t fAlphaType; | 85 uint8_t fAlphaType; |
| 89 SkDEBUGCODE(int fColorLockCount;) | 86 SkDEBUGCODE(int fColorLockCount;) |
| 90 SkDEBUGCODE(int f16BitCacheLockCount;) | 87 SkDEBUGCODE(int f16BitCacheLockCount;) |
| 91 | 88 |
| 92 void inval16BitCache(); | 89 void inval16BitCache(); |
| 93 | 90 |
| 94 typedef SkFlattenable INHERITED; | 91 typedef SkRefCnt INHERITED; |
| 95 }; | 92 }; |
| 96 | 93 |
| 97 #endif | 94 #endif |
| OLD | NEW |