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

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

Issue 1744103002: 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
209 /** 221 /**
210 * Move the cursor back to offset bytes from the beginning. 222 * Move the cursor back to offset bytes from the beginning.
211 * offset must be a multiple of 4 no greater than size(). 223 * offset must be a multiple of 4 no greater than size().
212 */ 224 */
213 void rewindToOffset(size_t offset) { 225 void rewindToOffset(size_t offset) {
214 SkASSERT(SkAlign4(offset) == offset); 226 SkASSERT(SkAlign4(offset) == offset);
215 SkASSERT(offset <= bytesWritten()); 227 SkASSERT(offset <= bytesWritten());
216 fUsed = offset; 228 fUsed = offset;
217 } 229 }
218 230
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 union { 273 union {
262 void* fPtrAlignment; 274 void* fPtrAlignment;
263 double fDoubleAlignment; 275 double fDoubleAlignment;
264 char fStorage[SIZE]; 276 char fStorage[SIZE];
265 } fData; 277 } fData;
266 278
267 typedef SkWriter32 INHERITED; 279 typedef SkWriter32 INHERITED;
268 }; 280 };
269 281
270 #endif 282 #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