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 |
286 SkPicture::SkPicture(SkPicturePlayback* playback, int width, int height) | 306 SkPicture::SkPicture(SkPicturePlayback* playback, int width, int height) |
287 : fPlayback(playback) | 307 : fPlayback(playback) |
288 , fRecord(NULL) | 308 , fRecord(NULL) |
289 , fWidth(width) | 309 , fWidth(width) |
290 , fHeight(height) {} | 310 , fHeight(height) {} |
291 | 311 |
292 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro
c) { | 312 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro
c) { |
293 SkPictInfo info; | 313 SkPictInfo info; |
294 | 314 |
295 if (!StreamIsSKP(stream, &info)) { | 315 if (!StreamIsSKP(stream, &info)) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 361 } |
342 | 362 |
343 #ifdef SK_BUILD_FOR_ANDROID | 363 #ifdef SK_BUILD_FOR_ANDROID |
344 void SkPicture::abortPlayback() { | 364 void SkPicture::abortPlayback() { |
345 if (NULL == fPlayback) { | 365 if (NULL == fPlayback) { |
346 return; | 366 return; |
347 } | 367 } |
348 fPlayback->abort(); | 368 fPlayback->abort(); |
349 } | 369 } |
350 #endif | 370 #endif |
OLD | NEW |