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

Side by Side Diff: include/core/SkWriter32.h

Issue 1761793003: Revert of move annotations to canvas virtual (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « include/core/SkPicture.h ('k') | include/private/SkRecords.h » ('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 2008 The Android Open Source Project 3 * Copyright 2008 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 #ifndef SkWriter32_DEFINED 10 #ifndef SkWriter32_DEFINED
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 */ 199 */
200 void writeString(const char* str, size_t len = (size_t)-1); 200 void writeString(const char* str, size_t len = (size_t)-1);
201 201
202 /** 202 /**
203 * Computes the size (aligned to multiple of 4) need to write the string 203 * Computes the size (aligned to multiple of 4) need to write the string
204 * in a call to writeString(). If the length is not specified, it will be 204 * in a call to writeString(). If the length is not specified, it will be
205 * computed by calling strlen(). 205 * computed by calling strlen().
206 */ 206 */
207 static size_t WriteStringSize(const char* str, size_t len = (size_t)-1); 207 static size_t WriteStringSize(const char* str, size_t len = (size_t)-1);
208 208
209 void writeData(const SkData* data) {
210 uint32_t len = data ? SkToU32(data->size()) : 0;
211 this->write32(len);
212 if (data) {
213 this->writePad(data->data(), len);
214 }
215 }
216
217 static size_t WriteDataSize(const SkData* data) {
218 return 4 + SkAlign4(data ? data->size() : 0);
219 }
220
221 /** 209 /**
222 * Move the cursor back to offset bytes from the beginning. 210 * Move the cursor back to offset bytes from the beginning.
223 * offset must be a multiple of 4 no greater than size(). 211 * offset must be a multiple of 4 no greater than size().
224 */ 212 */
225 void rewindToOffset(size_t offset) { 213 void rewindToOffset(size_t offset) {
226 SkASSERT(SkAlign4(offset) == offset); 214 SkASSERT(SkAlign4(offset) == offset);
227 SkASSERT(offset <= bytesWritten()); 215 SkASSERT(offset <= bytesWritten());
228 fUsed = offset; 216 fUsed = offset;
229 } 217 }
230 218
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 union { 261 union {
274 void* fPtrAlignment; 262 void* fPtrAlignment;
275 double fDoubleAlignment; 263 double fDoubleAlignment;
276 char fStorage[SIZE]; 264 char fStorage[SIZE];
277 } fData; 265 } fData;
278 266
279 typedef SkWriter32 INHERITED; 267 typedef SkWriter32 INHERITED;
280 }; 268 };
281 269
282 #endif 270 #endif
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | include/private/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698