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

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

Issue 29143005: Constify SkFlattenable::getFactory(). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkOrderedWriteBuffer.h ('k') | src/effects/SkColorFilters.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 2012 Google Inc. 3 * Copyright 2012 Google Inc.
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 #include "SkOrderedWriteBuffer.h" 9 #include "SkOrderedWriteBuffer.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 void SkOrderedWriteBuffer::setBitmapEncoder(SkPicture::EncodeBitmap bitmapEncode r) { 247 void SkOrderedWriteBuffer::setBitmapEncoder(SkPicture::EncodeBitmap bitmapEncode r) {
248 fBitmapEncoder = bitmapEncoder; 248 fBitmapEncoder = bitmapEncoder;
249 if (bitmapEncoder != NULL) { 249 if (bitmapEncoder != NULL) {
250 SkASSERT(NULL == fBitmapHeap); 250 SkASSERT(NULL == fBitmapHeap);
251 SkSafeUnref(fBitmapHeap); 251 SkSafeUnref(fBitmapHeap);
252 fBitmapHeap = NULL; 252 fBitmapHeap = NULL;
253 } 253 }
254 } 254 }
255 255
256 void SkOrderedWriteBuffer::writeFlattenable(SkFlattenable* flattenable) { 256 void SkOrderedWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) {
257 /* 257 /*
258 * If we have a factoryset, then the first 32bits tell us... 258 * If we have a factoryset, then the first 32bits tell us...
259 * 0: failure to write the flattenable 259 * 0: failure to write the flattenable
260 * >0: (1-based) index into the SkFactorySet or SkNamedFactorySet 260 * >0: (1-based) index into the SkFactorySet or SkNamedFactorySet
261 * If we don't have a factoryset, then the first "ptr" is either the 261 * If we don't have a factoryset, then the first "ptr" is either the
262 * factory, or null for failure. 262 * factory, or null for failure.
263 * 263 *
264 * The distinction is important, since 0-index is 32bits (always), but a 264 * The distinction is important, since 0-index is 32bits (always), but a
265 * 0-functionptr might be 32 or 64 bits. 265 * 0-functionptr might be 32 or 64 bits.
266 */ 266 */
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // make room for the size of the flattened object 305 // make room for the size of the flattened object
306 (void)fWriter.reserve(sizeof(uint32_t)); 306 (void)fWriter.reserve(sizeof(uint32_t));
307 // record the current size, so we can subtract after the object writes. 307 // record the current size, so we can subtract after the object writes.
308 uint32_t offset = fWriter.size(); 308 uint32_t offset = fWriter.size();
309 // now flatten the object 309 // now flatten the object
310 flattenObject(flattenable, *this); 310 flattenObject(flattenable, *this);
311 uint32_t objSize = fWriter.size() - offset; 311 uint32_t objSize = fWriter.size() - offset;
312 // record the obj's size 312 // record the obj's size
313 *fWriter.peek32(offset - sizeof(uint32_t)) = objSize; 313 *fWriter.peek32(offset - sizeof(uint32_t)) = objSize;
314 } 314 }
OLDNEW
« no previous file with comments | « src/core/SkOrderedWriteBuffer.h ('k') | src/effects/SkColorFilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698