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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 /////////////////////////////////////////////////////////////////////////////// | 86 /////////////////////////////////////////////////////////////////////////////// |
87 | 87 |
88 SkColorTable::SkColorTable(SkFlattenableReadBuffer& buffer) { | 88 SkColorTable::SkColorTable(SkFlattenableReadBuffer& buffer) { |
89 f16BitCache = NULL; | 89 f16BitCache = NULL; |
90 SkDEBUGCODE(fColorLockCount = 0;) | 90 SkDEBUGCODE(fColorLockCount = 0;) |
91 SkDEBUGCODE(f16BitCacheLockCount = 0;) | 91 SkDEBUGCODE(f16BitCacheLockCount = 0;) |
92 | 92 |
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(bool success =) buffer.readColorArray(fColors, fCount); |
97 #ifdef SK_DEBUG | 97 #ifdef SK_DEBUG |
98 SkASSERT((unsigned)fCount <= 256); | 98 SkASSERT((unsigned)fCount <= 256); |
99 SkASSERT(countRead == fCount); | 99 SkASSERT(success); |
100 #endif | 100 #endif |
101 } | 101 } |
102 | 102 |
103 void SkColorTable::writeToBuffer(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 |