Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: src/core/SkColorTable.cpp

Issue 764433003: Flail a little against LLVM crash. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkColorTable.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 uint16_t* operator()() const { 47 uint16_t* operator()() const {
48 uint16_t* cache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t)); 48 uint16_t* cache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t));
49 for (int i = 0; i < fCount; i++) { 49 for (int i = 0; i < fCount; i++) {
50 cache[i] = SkPixel32ToPixel16_ToU16(fColors[i]); 50 cache[i] = SkPixel32ToPixel16_ToU16(fColors[i]);
51 } 51 }
52 return cache; 52 return cache;
53 } 53 }
54 }; 54 };
55 }//namespace 55 }//namespace
56 56
57 void SkColorTable::Free16BitCache(uint16_t* cache) { sk_free(cache); }
58
57 const uint16_t* SkColorTable::read16BitCache() const { 59 const uint16_t* SkColorTable::read16BitCache() const {
58 const Build16BitCache create = { fColors, fCount }; 60 const Build16BitCache create = { fColors, fCount };
59 return f16BitCache.get(create); 61 return f16BitCache.get(create);
60 } 62 }
61 63
62 /////////////////////////////////////////////////////////////////////////////// 64 ///////////////////////////////////////////////////////////////////////////////
63 65
64 SkColorTable::SkColorTable(SkReadBuffer& buffer) { 66 SkColorTable::SkColorTable(SkReadBuffer& buffer) {
65 if (buffer.isVersionLT(SkReadBuffer::kRemoveColorTableAlpha_Version)) { 67 if (buffer.isVersionLT(SkReadBuffer::kRemoveColorTableAlpha_Version)) {
66 /*fAlphaType = */buffer.readUInt(); 68 /*fAlphaType = */buffer.readUInt();
(...skipping 11 matching lines...) Expand all
78 } 80 }
79 #ifdef SK_DEBUG 81 #ifdef SK_DEBUG
80 SkASSERT((unsigned)fCount <= 256); 82 SkASSERT((unsigned)fCount <= 256);
81 SkASSERT(success); 83 SkASSERT(success);
82 #endif 84 #endif
83 } 85 }
84 86
85 void SkColorTable::writeToBuffer(SkWriteBuffer& buffer) const { 87 void SkColorTable::writeToBuffer(SkWriteBuffer& buffer) const {
86 buffer.writeColorArray(fColors, fCount); 88 buffer.writeColorArray(fColors, fCount);
87 } 89 }
OLDNEW
« no previous file with comments | « include/core/SkColorTable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698