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

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

Issue 37803002: Adding size parameter to read array functions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed comments Created 7 years, 1 month 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 | Annotate | Revision Log
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 /////////////////////////////////////////////////////////////////////////////// 86 ///////////////////////////////////////////////////////////////////////////////
87 87
88 SkColorTable::SkColorTable(SkFlattenableReadBuffer& buffer) { 88 SkColorTable::SkColorTable(SkFlattenableReadBuffer& buffer) {
89 f16BitCache = NULL; 89 f16BitCache = NULL;
90 SkDEBUGCODE(fColorLockCount = 0;) 90 SkDEBUGCODE(fColorLockCount = 0;)
91 SkDEBUGCODE(f16BitCacheLockCount = 0;) 91 SkDEBUGCODE(f16BitCacheLockCount = 0;)
92 92
93 fAlphaType = SkToU8(buffer.readUInt()); 93 fAlphaType = SkToU8(buffer.readUInt());
94 fCount = buffer.getArrayCount(); 94 fCount = buffer.getArrayCount();
95 fColors = (SkPMColor*)sk_malloc_throw(fCount * sizeof(SkPMColor)); 95 fColors = (SkPMColor*)sk_malloc_throw(fCount * sizeof(SkPMColor));
96 SkDEBUGCODE(const uint32_t countRead =) buffer.readColorArray(fColors); 96 SkDEBUGCODE(bool success =) buffer.readColorArray(fColors, fCount);
97 #ifdef SK_DEBUG 97 #ifdef SK_DEBUG
98 SkASSERT((unsigned)fCount <= 256); 98 SkASSERT((unsigned)fCount <= 256);
99 SkASSERT(countRead == fCount); 99 SkASSERT(success);
100 #endif 100 #endif
101 } 101 }
102 102
103 void SkColorTable::writeToBuffer(SkFlattenableWriteBuffer& buffer) const { 103 void SkColorTable::writeToBuffer(SkFlattenableWriteBuffer& buffer) const {
104 buffer.writeUInt(fAlphaType); 104 buffer.writeUInt(fAlphaType);
105 buffer.writeColorArray(fColors, fCount); 105 buffer.writeColorArray(fColors, fCount);
106 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698