OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
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 "SkErrorInternals.h" | 9 |
10 #include "SkPictureFlat.h" | 10 #include "SkPictureFlat.h" |
11 #include "SkPicturePlayback.h" | 11 #include "SkPicturePlayback.h" |
12 #include "SkPictureRecord.h" | 12 #include "SkPictureRecord.h" |
13 | 13 |
14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
15 #include "SkChunkAlloc.h" | 15 #include "SkChunkAlloc.h" |
16 #include "SkDevice.h" | 16 #include "SkDevice.h" |
17 #include "SkPicture.h" | 17 #include "SkPicture.h" |
18 #include "SkRegion.h" | 18 #include "SkRegion.h" |
19 #include "SkStream.h" | 19 #include "SkStream.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 if (success) { | 276 if (success) { |
277 *success = false; | 277 *success = false; |
278 } | 278 } |
279 fRecord = NULL; | 279 fRecord = NULL; |
280 fPlayback = NULL; | 280 fPlayback = NULL; |
281 fWidth = fHeight = 0; | 281 fWidth = fHeight = 0; |
282 | 282 |
283 SkPictInfo info; | 283 SkPictInfo info; |
284 | 284 |
285 if (!stream->read(&info, sizeof(info))) { | 285 if (!stream->read(&info, sizeof(info))) { |
286 SkErrorInternals::SetError(kParseError_SkError, "Failed to parse skp inf
o."); | 286 return; |
| 287 } |
| 288 if (PICTURE_VERSION != info.fVersion) { |
287 return; | 289 return; |
288 } | 290 } |
289 | 291 |
290 if (info.fVersion < 10 || info.fVersion > PICTURE_VERSION) { | |
291 SkErrorInternals::SetError(kParseError_SkError, "skp version %d not supp
orted.", | |
292 info.fVersion); | |
293 return; | |
294 } | |
295 | |
296 if (stream->readBool()) { | 292 if (stream->readBool()) { |
297 fPlayback = SkNEW_ARGS(SkPicturePlayback, (stream, info, proc)); | 293 fPlayback = SkNEW_ARGS(SkPicturePlayback, (stream, info, proc)); |
298 } | 294 } |
299 | 295 |
300 // do this at the end, so that they will be zero if we hit an error. | 296 // do this at the end, so that they will be zero if we hit an error. |
301 fWidth = info.fWidth; | 297 fWidth = info.fWidth; |
302 fHeight = info.fHeight; | 298 fHeight = info.fHeight; |
303 if (success) { | 299 if (success) { |
304 *success = true; | 300 *success = true; |
305 } | 301 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 335 } |
340 | 336 |
341 #ifdef SK_BUILD_FOR_ANDROID | 337 #ifdef SK_BUILD_FOR_ANDROID |
342 void SkPicture::abortPlayback() { | 338 void SkPicture::abortPlayback() { |
343 if (NULL == fPlayback) { | 339 if (NULL == fPlayback) { |
344 return; | 340 return; |
345 } | 341 } |
346 fPlayback->abort(); | 342 fPlayback->abort(); |
347 } | 343 } |
348 #endif | 344 #endif |
OLD | NEW |