OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2009 The Android Open Source Project | 3 * Copyright 2009 The Android Open Source Project |
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 #include "SkColorTable.h" | 10 #include "SkColorTable.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 fAlphaType = SkToU8(buffer.readUInt()); | 93 fAlphaType = SkToU8(buffer.readUInt()); |
94 fCount = buffer.getArrayCount(); | 94 fCount = buffer.getArrayCount(); |
95 fColors = (SkPMColor*)sk_malloc_throw(fCount * sizeof(SkPMColor)); | 95 fColors = (SkPMColor*)sk_malloc_throw(fCount * sizeof(SkPMColor)); |
96 SkDEBUGCODE(const uint32_t countRead =) buffer.readColorArray(fColors); | 96 SkDEBUGCODE(const uint32_t countRead =) buffer.readColorArray(fColors); |
97 #ifdef SK_DEBUG | 97 #ifdef SK_DEBUG |
98 SkASSERT((unsigned)fCount <= 256); | 98 SkASSERT((unsigned)fCount <= 256); |
99 SkASSERT(countRead == fCount); | 99 SkASSERT(countRead == fCount); |
100 #endif | 100 #endif |
101 } | 101 } |
102 | 102 |
103 void SkColorTable::flatten(SkFlattenableWriteBuffer& buffer) const { | 103 void SkColorTable::writeToBuffer(SkFlattenableWriteBuffer& buffer) const { |
104 buffer.writeUInt(fAlphaType); | 104 buffer.writeUInt(fAlphaType); |
105 buffer.writeColorArray(fColors, fCount); | 105 buffer.writeColorArray(fColors, fCount); |
106 } | 106 } |
OLD | NEW |