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

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

Issue 145053003: Have peek32 return uint32_t& to make it harder to look at more than 4 bytes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: read write at 32 Created 6 years, 10 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/SkPictureRecord.cpp ('k') | tests/Writer32Test.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 "SkWriteBuffer.h" 9 #include "SkWriteBuffer.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 314 }
315 315
316 // make room for the size of the flattened object 316 // make room for the size of the flattened object
317 (void)fWriter.reserve(sizeof(uint32_t)); 317 (void)fWriter.reserve(sizeof(uint32_t));
318 // record the current size, so we can subtract after the object writes. 318 // record the current size, so we can subtract after the object writes.
319 uint32_t offset = fWriter.bytesWritten(); 319 uint32_t offset = fWriter.bytesWritten();
320 // now flatten the object 320 // now flatten the object
321 flattenable->flatten(*this); 321 flattenable->flatten(*this);
322 uint32_t objSize = fWriter.bytesWritten() - offset; 322 uint32_t objSize = fWriter.bytesWritten() - offset;
323 // record the obj's size 323 // record the obj's size
324 *fWriter.peek32(offset - sizeof(uint32_t)) = objSize; 324 fWriter.write32At(offset - sizeof(uint32_t), objSize);
325 } 325 }
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | tests/Writer32Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698