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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 // if we get here, factory may still be null, but if that is the case, the | 296 // if we get here, factory may still be null, but if that is the case, the |
297 // failure was ours, not the writer. | 297 // failure was ours, not the writer. |
298 SkFlattenable* obj = NULL; | 298 SkFlattenable* obj = NULL; |
299 uint32_t sizeRecorded = fReader.readU32(); | 299 uint32_t sizeRecorded = fReader.readU32(); |
300 if (factory) { | 300 if (factory) { |
301 uint32_t offset = fReader.offset(); | 301 uint32_t offset = fReader.offset(); |
302 obj = (*factory)(*this); | 302 obj = (*factory)(*this); |
303 if (fError != kNoError_SkError) { | |
304 delete obj; | |
305 obj = NULL; | |
306 fError = kNoError_SkError; | |
reed1
2013/08/21 15:49:24
Hmmm, maybe this is correct (to reset fError to no
sugoi1
2013/08/21 16:52:36
It's only reset here so that the next read operati
scroggo
2013/08/21 23:56:00
This seems to be basically the same, since SkOrder
| |
307 } | |
303 // check that we read the amount we expected | 308 // check that we read the amount we expected |
304 uint32_t sizeRead = fReader.offset() - offset; | 309 uint32_t sizeRead = fReader.offset() - offset; |
305 if (sizeRecorded != sizeRead) { | 310 if (sizeRecorded != sizeRead) { |
306 // we could try to fix up the offset... | 311 // we could try to fix up the offset... |
307 sk_throw(); | 312 sk_throw(); |
308 } | 313 } |
309 } else { | 314 } else { |
310 // we must skip the remaining data | 315 // we must skip the remaining data |
311 fReader.skip(sizeRecorded); | 316 fReader.skip(sizeRecorded); |
312 } | 317 } |
313 return obj; | 318 return obj; |
314 } | 319 } |
OLD | NEW |