| OLD | NEW |
| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 if (NULL == factory) { | 314 if (NULL == factory) { |
| 315 return NULL; // writer failed to give us the flattenable | 315 return NULL; // writer failed to give us the flattenable |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 | 318 |
| 319 // if we get here, factory may still be null, but if that is the case, the | 319 // if we get here, factory may still be null, but if that is the case, the |
| 320 // failure was ours, not the writer. | 320 // failure was ours, not the writer. |
| 321 SkFlattenable* obj = NULL; | 321 SkFlattenable* obj = NULL; |
| 322 uint32_t sizeRecorded = fReader.readU32(); | 322 uint32_t sizeRecorded = fReader.readU32(); |
| 323 if (factory) { | 323 if (factory) { |
| 324 uint32_t offset = fReader.offset(); | 324 size_t offset = fReader.offset(); |
| 325 obj = (*factory)(*this); | 325 obj = (*factory)(*this); |
| 326 // check that we read the amount we expected | 326 // check that we read the amount we expected |
| 327 uint32_t sizeRead = fReader.offset() - offset; | 327 size_t sizeRead = fReader.offset() - offset; |
| 328 if (sizeRecorded != sizeRead) { | 328 if (sizeRecorded != sizeRead) { |
| 329 // we could try to fix up the offset... | 329 // we could try to fix up the offset... |
| 330 sk_throw(); | 330 sk_throw(); |
| 331 } | 331 } |
| 332 } else { | 332 } else { |
| 333 // we must skip the remaining data | 333 // we must skip the remaining data |
| 334 fReader.skip(sizeRecorded); | 334 fReader.skip(sizeRecorded); |
| 335 } | 335 } |
| 336 return obj; | 336 return obj; |
| 337 } | 337 } |
| OLD | NEW |