| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 *dst++ = SkPixel32ToPixel16_ToU16(*src++); | 63 *dst++ = SkPixel32ToPixel16_ToU16(*src++); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 const uint16_t* SkColorTable::lock16BitCache() { | 67 const uint16_t* SkColorTable::lock16BitCache() { |
| 68 if (NULL == f16BitCache) { | 68 if (NULL == f16BitCache) { |
| 69 f16BitCache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t)); | 69 f16BitCache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t)); |
| 70 build_16bitcache(f16BitCache, fColors, fCount); | 70 build_16bitcache(f16BitCache, fColors, fCount); |
| 71 } | 71 } |
| 72 | 72 |
| 73 SkDEBUGCODE(f16BitCacheLockCount += 1); | 73 SkDEBUGCODE(sk_atomic_inc(&f16BitCacheLockCount)); |
| 74 return f16BitCache; | 74 return f16BitCache; |
| 75 } | 75 } |
| 76 | 76 |
| 77 /////////////////////////////////////////////////////////////////////////////// | 77 /////////////////////////////////////////////////////////////////////////////// |
| 78 | 78 |
| 79 SkColorTable::SkColorTable(SkReadBuffer& buffer) { | 79 SkColorTable::SkColorTable(SkReadBuffer& buffer) { |
| 80 f16BitCache = NULL; | 80 f16BitCache = NULL; |
| 81 SkDEBUGCODE(fColorLockCount = 0;) | 81 SkDEBUGCODE(fColorLockCount = 0;) |
| 82 SkDEBUGCODE(f16BitCacheLockCount = 0;) | 82 SkDEBUGCODE(f16BitCacheLockCount = 0;) |
| 83 | 83 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 97 } | 97 } |
| 98 #ifdef SK_DEBUG | 98 #ifdef SK_DEBUG |
| 99 SkASSERT((unsigned)fCount <= 256); | 99 SkASSERT((unsigned)fCount <= 256); |
| 100 SkASSERT(success); | 100 SkASSERT(success); |
| 101 #endif | 101 #endif |
| 102 } | 102 } |
| 103 | 103 |
| 104 void SkColorTable::writeToBuffer(SkWriteBuffer& buffer) const { | 104 void SkColorTable::writeToBuffer(SkWriteBuffer& buffer) const { |
| 105 buffer.writeColorArray(fColors, fCount); | 105 buffer.writeColorArray(fColors, fCount); |
| 106 } | 106 } |
| OLD | NEW |