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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 months 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 | « src/core/SkClipStack.cpp ('k') | src/core/SkDeque.cpp » ('j') | 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 13 matching lines...) Expand all
24 sk_malloc_throw(count * sizeof(SkPMColor))); 24 sk_malloc_throw(count * sizeof(SkPMColor)));
25 memcpy(fColors, src.fColors, count * sizeof(SkPMColor)); 25 memcpy(fColors, src.fColors, count * sizeof(SkPMColor));
26 26
27 SkDEBUGCODE(fColorLockCount = 0;) 27 SkDEBUGCODE(fColorLockCount = 0;)
28 SkDEBUGCODE(f16BitCacheLockCount = 0;) 28 SkDEBUGCODE(f16BitCacheLockCount = 0;)
29 } 29 }
30 30
31 SkColorTable::SkColorTable(const SkPMColor colors[], int count, SkAlphaType at) 31 SkColorTable::SkColorTable(const SkPMColor colors[], int count, SkAlphaType at)
32 : f16BitCache(NULL), fAlphaType(SkToU8(at)) 32 : f16BitCache(NULL), fAlphaType(SkToU8(at))
33 { 33 {
34 SkASSERT(0 == count || NULL != colors); 34 SkASSERT(0 == count || colors);
35 35
36 if (count < 0) { 36 if (count < 0) {
37 count = 0; 37 count = 0;
38 } else if (count > 256) { 38 } else if (count > 256) {
39 count = 256; 39 count = 256;
40 } 40 }
41 41
42 fCount = SkToU16(count); 42 fCount = SkToU16(count);
43 fColors = reinterpret_cast<SkPMColor*>( 43 fColors = reinterpret_cast<SkPMColor*>(
44 sk_malloc_throw(count * sizeof(SkPMColor))); 44 sk_malloc_throw(count * sizeof(SkPMColor)));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 #ifdef SK_DEBUG 103 #ifdef SK_DEBUG
104 SkASSERT((unsigned)fCount <= 256); 104 SkASSERT((unsigned)fCount <= 256);
105 SkASSERT(success); 105 SkASSERT(success);
106 #endif 106 #endif
107 } 107 }
108 108
109 void SkColorTable::writeToBuffer(SkWriteBuffer& buffer) const { 109 void SkColorTable::writeToBuffer(SkWriteBuffer& buffer) const {
110 buffer.writeUInt(fAlphaType); 110 buffer.writeUInt(fAlphaType);
111 buffer.writeColorArray(fColors, fCount); 111 buffer.writeColorArray(fColors, fCount);
112 } 112 }
OLDNEW
« no previous file with comments | « src/core/SkClipStack.cpp ('k') | src/core/SkDeque.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698