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() { | 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 Loading... |
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 } |
OLD | NEW |