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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 buffer.validate(false); | 100 buffer.validate(false); |
101 return nullptr; | 101 return nullptr; |
102 } | 102 } |
103 | 103 |
104 const size_t allocSize = count * sizeof(SkPMColor); | 104 const size_t allocSize = count * sizeof(SkPMColor); |
105 SkAutoTDelete<SkPMColor> colors((SkPMColor*)sk_malloc_throw(allocSize)); | 105 SkAutoTDelete<SkPMColor> colors((SkPMColor*)sk_malloc_throw(allocSize)); |
106 if (!buffer.readColorArray(colors, count)) { | 106 if (!buffer.readColorArray(colors, count)) { |
107 return nullptr; | 107 return nullptr; |
108 } | 108 } |
109 | 109 |
110 return new SkColorTable(colors.detach(), count, kAllocatedWithMalloc); | 110 return new SkColorTable(colors.release(), count, kAllocatedWithMalloc); |
111 } | 111 } |
112 | 112 |
OLD | NEW |