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

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

Issue 26702002: force readbuffer clients to use specialized readFoo for flattenables (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/SkOrderedReadBuffer.h ('k') | src/core/SkPaint.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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkErrorInternals.h" 10 #include "SkErrorInternals.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 if (index) { 261 if (index) {
262 SkDebugf("====== typeface index %d\n", index); 262 SkDebugf("====== typeface index %d\n", index);
263 } 263 }
264 return NULL; 264 return NULL;
265 } else { 265 } else {
266 SkASSERT(fTFArray); 266 SkASSERT(fTFArray);
267 return fTFArray[index - 1]; 267 return fTFArray[index - 1];
268 } 268 }
269 } 269 }
270 270
271 SkFlattenable* SkOrderedReadBuffer::readFlattenable() { 271 SkFlattenable* SkOrderedReadBuffer::readFlattenable(SkEffectType et) {
272 //
273 // TODO: confirm that et matches the factory we decide to use
274 //
275
272 SkFlattenable::Factory factory = NULL; 276 SkFlattenable::Factory factory = NULL;
273 277
274 if (fFactoryCount > 0) { 278 if (fFactoryCount > 0) {
275 int32_t index = fReader.readU32(); 279 int32_t index = fReader.readU32();
276 if (0 == index) { 280 if (0 == index) {
277 return NULL; // writer failed to give us the flattenable 281 return NULL; // writer failed to give us the flattenable
278 } 282 }
279 index -= 1; // we stored the index-base-1 283 index -= 1; // we stored the index-base-1
280 SkASSERT(index < fFactoryCount); 284 SkASSERT(index < fFactoryCount);
281 factory = fFactoryArray[index]; 285 factory = fFactoryArray[index];
(...skipping 23 matching lines...) Expand all
305 if (sizeRecorded != sizeRead) { 309 if (sizeRecorded != sizeRead) {
306 // we could try to fix up the offset... 310 // we could try to fix up the offset...
307 sk_throw(); 311 sk_throw();
308 } 312 }
309 } else { 313 } else {
310 // we must skip the remaining data 314 // we must skip the remaining data
311 fReader.skip(sizeRecorded); 315 fReader.skip(sizeRecorded);
312 } 316 }
313 return obj; 317 return obj;
314 } 318 }
OLDNEW
« no previous file with comments | « src/core/SkOrderedReadBuffer.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698