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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 /** Return the array of colors for reading. | 44 /** Return the array of colors for reading. |
45 */ | 45 */ |
46 const SkPMColor* readColors() const { return fColors; } | 46 const SkPMColor* readColors() const { return fColors; } |
47 | 47 |
48 /** read16BitCache() returns the array of RGB16 colors that mirror the 32bit
colors. | 48 /** read16BitCache() returns the array of RGB16 colors that mirror the 32bit
colors. |
49 */ | 49 */ |
50 const uint16_t* read16BitCache() const; | 50 const uint16_t* read16BitCache() const; |
51 | 51 |
52 explicit SkColorTable(SkReadBuffer&); | |
53 void writeToBuffer(SkWriteBuffer&) const; | 52 void writeToBuffer(SkWriteBuffer&) const; |
54 | 53 |
| 54 // may return null |
| 55 static SkColorTable* Create(SkReadBuffer&); |
| 56 |
55 private: | 57 private: |
56 static void Free16BitCache(uint16_t*); | 58 static void Free16BitCache(uint16_t*); |
57 | 59 |
| 60 enum AllocatedWithMalloc { |
| 61 kAllocatedWithMalloc |
| 62 }; |
| 63 // assumes ownership of colors (assumes it was allocated w/ malloc) |
| 64 SkColorTable(SkPMColor* colors, int count, AllocatedWithMalloc); |
| 65 |
58 SkPMColor* fColors; | 66 SkPMColor* fColors; |
59 SkLazyPtr<uint16_t, Free16BitCache> f16BitCache; | 67 SkLazyPtr<uint16_t, Free16BitCache> f16BitCache; |
60 int fCount; | 68 int fCount; |
61 | 69 |
62 void init(const SkPMColor* colors, int count); | 70 void init(const SkPMColor* colors, int count); |
63 | 71 |
64 typedef SkRefCnt INHERITED; | 72 typedef SkRefCnt INHERITED; |
65 }; | 73 }; |
66 | 74 |
67 #endif | 75 #endif |
OLD | NEW |