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

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

Issue 1853383002: Revert of Delete SkFlattenable::Type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/SkReadBuffer.h ('k') | src/core/SkScalerContext.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkErrorInternals.h" 9 #include "SkErrorInternals.h"
10 #include "SkImage.h" 10 #include "SkImage.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 uint32_t index = fReader.readU32(); 323 uint32_t index = fReader.readU32();
324 if (0 == index || index > (unsigned)fTFCount) { 324 if (0 == index || index > (unsigned)fTFCount) {
325 return nullptr; 325 return nullptr;
326 } else { 326 } else {
327 SkASSERT(fTFArray); 327 SkASSERT(fTFArray);
328 return fTFArray[index - 1]; 328 return fTFArray[index - 1];
329 } 329 }
330 } 330 }
331 331
332 SkFlattenable* SkReadBuffer::readFlattenable() { 332 SkFlattenable* SkReadBuffer::readFlattenable(SkFlattenable::Type ft) {
333 //
334 // TODO: confirm that ft matches the factory we decide to use
335 //
336
333 SkFlattenable::Factory factory = nullptr; 337 SkFlattenable::Factory factory = nullptr;
334 338
335 if (fFactoryCount > 0) { 339 if (fFactoryCount > 0) {
336 int32_t index = fReader.readU32(); 340 int32_t index = fReader.readU32();
337 if (0 == index) { 341 if (0 == index) {
338 return nullptr; // writer failed to give us the flattenable 342 return nullptr; // writer failed to give us the flattenable
339 } 343 }
340 index -= 1; // we stored the index-base-1 344 index -= 1; // we stored the index-base-1
341 if ((unsigned)index >= (unsigned)fFactoryCount) { 345 if ((unsigned)index >= (unsigned)fFactoryCount) {
342 this->validate(false); 346 this->validate(false);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 return; 384 return;
381 } 385 }
382 } else { 386 } else {
383 if (nullptr == this->readFunctionPtr()) { 387 if (nullptr == this->readFunctionPtr()) {
384 return; 388 return;
385 } 389 }
386 } 390 }
387 uint32_t sizeRecorded = fReader.readU32(); 391 uint32_t sizeRecorded = fReader.readU32();
388 fReader.skip(sizeRecorded); 392 fReader.skip(sizeRecorded);
389 } 393 }
OLDNEW
« no previous file with comments | « src/core/SkReadBuffer.h ('k') | src/core/SkScalerContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698