OLD | NEW |
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 Loading... |
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(SkFlattenable::Type ft) { | 332 SkFlattenable* SkReadBuffer::readFlattenable() { |
333 // | |
334 // TODO: confirm that ft matches the factory we decide to use | |
335 // | |
336 | |
337 SkFlattenable::Factory factory = nullptr; | 333 SkFlattenable::Factory factory = nullptr; |
338 | 334 |
339 if (fFactoryCount > 0) { | 335 if (fFactoryCount > 0) { |
340 int32_t index = fReader.readU32(); | 336 int32_t index = fReader.readU32(); |
341 if (0 == index) { | 337 if (0 == index) { |
342 return nullptr; // writer failed to give us the flattenable | 338 return nullptr; // writer failed to give us the flattenable |
343 } | 339 } |
344 index -= 1; // we stored the index-base-1 | 340 index -= 1; // we stored the index-base-1 |
345 if ((unsigned)index >= (unsigned)fFactoryCount) { | 341 if ((unsigned)index >= (unsigned)fFactoryCount) { |
346 this->validate(false); | 342 this->validate(false); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 return; | 380 return; |
385 } | 381 } |
386 } else { | 382 } else { |
387 if (nullptr == this->readFunctionPtr()) { | 383 if (nullptr == this->readFunctionPtr()) { |
388 return; | 384 return; |
389 } | 385 } |
390 } | 386 } |
391 uint32_t sizeRecorded = fReader.readU32(); | 387 uint32_t sizeRecorded = fReader.readU32(); |
392 fReader.skip(sizeRecorded); | 388 fReader.skip(sizeRecorded); |
393 } | 389 } |
OLD | NEW |