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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 SkColorTable(SkPMColor* colors, int count, AllocatedWithMalloc); | 62 SkColorTable(SkPMColor* colors, int count, AllocatedWithMalloc); |
63 | 63 |
64 SkPMColor* fColors; | 64 SkPMColor* fColors; |
65 mutable uint16_t* f16BitCache = nullptr; | 65 mutable uint16_t* f16BitCache = nullptr; |
66 mutable SkOnce f16BitCacheOnce; | 66 mutable SkOnce f16BitCacheOnce; |
67 int fCount; | 67 int fCount; |
68 | 68 |
69 void init(const SkPMColor* colors, int count); | 69 void init(const SkPMColor* colors, int count); |
70 | 70 |
71 friend class SkImageGenerator; | 71 friend class SkImageGenerator; |
| 72 friend class SkBitmapRegionCodec; |
72 // Only call if no other thread or cache has seen this table. | 73 // Only call if no other thread or cache has seen this table. |
73 void dangerous_overwriteColors(const SkPMColor newColors[], int count) { | 74 void dangerous_overwriteColors(const SkPMColor newColors[], int count) { |
74 if (count < 0 || count > fCount) { | 75 if (count < 0 || count > fCount) { |
75 sk_throw(); | 76 sk_throw(); |
76 } | 77 } |
77 // assumes that f16BitCache nas NOT been initialized yet, so we don't tr
y to update it | 78 // assumes that f16BitCache nas NOT been initialized yet, so we don't tr
y to update it |
78 memcpy(fColors, newColors, count * sizeof(SkPMColor)); | 79 memcpy(fColors, newColors, count * sizeof(SkPMColor)); |
79 fCount = count; // update fCount, in case count is smaller | 80 fCount = count; // update fCount, in case count is smaller |
80 } | 81 } |
81 | 82 |
82 typedef SkRefCnt INHERITED; | 83 typedef SkRefCnt INHERITED; |
83 }; | 84 }; |
84 | 85 |
85 #endif | 86 #endif |
OLD | NEW |