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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 if (PICTURE_VERSION != info.fVersion) { | 276 if (PICTURE_VERSION != info.fVersion) { |
277 return false; | 277 return false; |
278 } | 278 } |
279 | 279 |
280 if (pInfo != NULL) { | 280 if (pInfo != NULL) { |
281 *pInfo = info; | 281 *pInfo = info; |
282 } | 282 } |
283 return true; | 283 return true; |
284 } | 284 } |
285 | 285 |
286 SkPicture::SkPicture(SkStream* stream, bool* success, InstallPixelRefProc proc)
{ | |
287 fRecord = NULL; | |
288 SkAutoTUnref<SkPicture> picture(CreateFromStream(stream, proc)); | |
289 if (NULL == picture.get()) { | |
290 fPlayback = NULL; | |
291 fWidth = fHeight = 0; | |
292 if (success) { | |
293 *success = false; | |
294 } | |
295 } else { | |
296 fPlayback = picture->fPlayback; | |
297 picture->fPlayback = NULL; | |
298 fWidth = picture->fWidth; | |
299 fHeight = picture->fHeight; | |
300 if (success) { | |
301 *success = true; | |
302 } | |
303 } | |
304 } | |
305 | |
306 SkPicture::SkPicture(SkPicturePlayback* playback, int width, int height) | 286 SkPicture::SkPicture(SkPicturePlayback* playback, int width, int height) |
307 : fPlayback(playback) | 287 : fPlayback(playback) |
308 , fRecord(NULL) | 288 , fRecord(NULL) |
309 , fWidth(width) | 289 , fWidth(width) |
310 , fHeight(height) {} | 290 , fHeight(height) {} |
311 | 291 |
312 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro
c) { | 292 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro
c) { |
313 SkPictInfo info; | 293 SkPictInfo info; |
314 | 294 |
315 if (!StreamIsSKP(stream, &info)) { | 295 if (!StreamIsSKP(stream, &info)) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 341 } |
362 | 342 |
363 #ifdef SK_BUILD_FOR_ANDROID | 343 #ifdef SK_BUILD_FOR_ANDROID |
364 void SkPicture::abortPlayback() { | 344 void SkPicture::abortPlayback() { |
365 if (NULL == fPlayback) { | 345 if (NULL == fPlayback) { |
366 return; | 346 return; |
367 } | 347 } |
368 fPlayback->abort(); | 348 fPlayback->abort(); |
369 } | 349 } |
370 #endif | 350 #endif |
OLD | NEW |