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 | 9 |
10 #include "SkPictureFlat.h" | 10 #include "SkPictureFlat.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro c) { | 303 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro c) { |
304 SkPictInfo info; | 304 SkPictInfo info; |
305 | 305 |
306 if (!StreamIsSKP(stream, &info)) { | 306 if (!StreamIsSKP(stream, &info)) { |
307 return NULL; | 307 return NULL; |
308 } | 308 } |
309 | 309 |
310 SkPicturePlayback* playback; | 310 SkPicturePlayback* playback; |
311 // Check to see if there is a playback to recreate. | 311 // Check to see if there is a playback to recreate. |
312 if (stream->readBool()) { | 312 if (stream->readBool()) { |
313 playback = SkNEW_ARGS(SkPicturePlayback, (stream, info, proc)); | 313 bool isValid = false; |
caryclark
2013/09/26 21:12:46
It looks like this argues for creating a SkPicture
reed1
2013/09/26 21:16:07
+1
scroggo
2013/09/26 22:17:46
I think that is generally a better pattern (this c
| |
314 playback = SkNEW_ARGS(SkPicturePlayback, (stream, info, &isValid, proc)) ; | |
315 if (!isValid) { | |
316 SkDELETE(playback); | |
317 return NULL; | |
318 } | |
314 } else { | 319 } else { |
315 playback = NULL; | 320 playback = NULL; |
316 } | 321 } |
317 | 322 |
318 return SkNEW_ARGS(SkPicture, (playback, info.fWidth, info.fHeight)); | 323 return SkNEW_ARGS(SkPicture, (playback, info.fWidth, info.fHeight)); |
319 } | 324 } |
320 | 325 |
321 void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { | 326 void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { |
322 SkPicturePlayback* playback = fPlayback; | 327 SkPicturePlayback* playback = fPlayback; |
323 | 328 |
(...skipping 28 matching lines...) Expand all Loading... | |
352 } | 357 } |
353 | 358 |
354 #ifdef SK_BUILD_FOR_ANDROID | 359 #ifdef SK_BUILD_FOR_ANDROID |
355 void SkPicture::abortPlayback() { | 360 void SkPicture::abortPlayback() { |
356 if (NULL == fPlayback) { | 361 if (NULL == fPlayback) { |
357 return; | 362 return; |
358 } | 363 } |
359 fPlayback->abort(); | 364 fPlayback->abort(); |
360 } | 365 } |
361 #endif | 366 #endif |
OLD | NEW |