| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 fCount = buffer.getArrayCount(); | 71 fCount = buffer.getArrayCount(); |
| 72 size_t allocSize = fCount * sizeof(SkPMColor); | 72 size_t allocSize = fCount * sizeof(SkPMColor); |
| 73 SkDEBUGCODE(bool success = false;) | 73 SkDEBUGCODE(bool success = false;) |
| 74 if (buffer.validateAvailable(allocSize)) { | 74 if (buffer.validateAvailable(allocSize)) { |
| 75 fColors = (SkPMColor*)sk_malloc_throw(allocSize); | 75 fColors = (SkPMColor*)sk_malloc_throw(allocSize); |
| 76 SkDEBUGCODE(success =) buffer.readColorArray(fColors, fCount); | 76 SkDEBUGCODE(success =) buffer.readColorArray(fColors, fCount); |
| 77 } else { | 77 } else { |
| 78 fCount = 0; | 78 fCount = 0; |
| 79 fColors = NULL; | 79 fColors = nullptr; |
| 80 } | 80 } |
| 81 #ifdef SK_DEBUG | 81 #ifdef SK_DEBUG |
| 82 SkASSERT((unsigned)fCount <= 256); | 82 SkASSERT((unsigned)fCount <= 256); |
| 83 SkASSERT(success); | 83 SkASSERT(success); |
| 84 #endif | 84 #endif |
| 85 } | 85 } |
| 86 | 86 |
| 87 void SkColorTable::writeToBuffer(SkWriteBuffer& buffer) const { | 87 void SkColorTable::writeToBuffer(SkWriteBuffer& buffer) const { |
| 88 buffer.writeColorArray(fColors, fCount); | 88 buffer.writeColorArray(fColors, fCount); |
| 89 } | 89 } |
| OLD | NEW |