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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (!InternalOnly_StreamIsSKP(stream, &info)) { | 424 if (!InternalOnly_StreamIsSKP(stream, &info)) { |
425 return NULL; | 425 return NULL; |
426 } | 426 } |
427 | 427 |
428 // Check to see if there is a playback to recreate. | 428 // Check to see if there is a playback to recreate. |
429 if (stream->readBool()) { | 429 if (stream->readBool()) { |
430 SkPictureData* data = SkPictureData::CreateFromStream(stream, info, proc
); | 430 SkPictureData* data = SkPictureData::CreateFromStream(stream, info, proc
); |
431 if (NULL == data) { | 431 if (NULL == data) { |
432 return NULL; | 432 return NULL; |
433 } | 433 } |
| 434 #if 0 |
434 const SkPicture src(data, info.fWidth, info.fHeight); | 435 const SkPicture src(data, info.fWidth, info.fHeight); |
435 return Forwardport(src); | 436 return Forwardport(src); |
| 437 #else |
| 438 return SkNEW_ARGS(SkPicture, (data, info.fWidth, info.fHeight)); |
| 439 #endif |
436 } | 440 } |
437 | 441 |
438 return NULL; | 442 return NULL; |
439 } | 443 } |
440 | 444 |
441 // fRecord OK | 445 // fRecord OK |
442 SkPicture* SkPicture::CreateFromBuffer(SkReadBuffer& buffer) { | 446 SkPicture* SkPicture::CreateFromBuffer(SkReadBuffer& buffer) { |
443 SkPictInfo info; | 447 SkPictInfo info; |
444 | 448 |
445 if (!InternalOnly_BufferIsSKP(buffer, &info)) { | 449 if (!InternalOnly_BufferIsSKP(buffer, &info)) { |
446 return NULL; | 450 return NULL; |
447 } | 451 } |
448 | 452 |
449 // Check to see if there is a playback to recreate. | 453 // Check to see if there is a playback to recreate. |
450 if (buffer.readBool()) { | 454 if (buffer.readBool()) { |
451 SkPictureData* data = SkPictureData::CreateFromBuffer(buffer, info); | 455 SkPictureData* data = SkPictureData::CreateFromBuffer(buffer, info); |
452 if (NULL == data) { | 456 if (NULL == data) { |
453 return NULL; | 457 return NULL; |
454 } | 458 } |
| 459 #if 0 |
455 const SkPicture src(data, info.fWidth, info.fHeight); | 460 const SkPicture src(data, info.fWidth, info.fHeight); |
456 return Forwardport(src); | 461 return Forwardport(src); |
| 462 #else |
| 463 return SkNEW_ARGS(SkPicture, (data, info.fWidth, info.fHeight)); |
| 464 #endif |
457 } | 465 } |
458 | 466 |
459 return NULL; | 467 return NULL; |
460 } | 468 } |
461 | 469 |
462 // fRecord OK | 470 // fRecord OK |
463 void SkPicture::createHeader(SkPictInfo* info) const { | 471 void SkPicture::createHeader(SkPictInfo* info) const { |
464 // Copy magic bytes at the beginning of the header | 472 // Copy magic bytes at the beginning of the header |
465 SkASSERT(sizeof(kMagic) == 8); | 473 SkASSERT(sizeof(kMagic) == 8); |
466 SkASSERT(sizeof(kMagic) == sizeof(info->fMagic)); | 474 SkASSERT(sizeof(kMagic) == sizeof(info->fMagic)); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 int SkPicture::approximateOpCount() const { | 632 int SkPicture::approximateOpCount() const { |
625 SkASSERT(fRecord.get() || fData.get()); | 633 SkASSERT(fRecord.get() || fData.get()); |
626 if (fRecord.get()) { | 634 if (fRecord.get()) { |
627 return fRecord->count(); | 635 return fRecord->count(); |
628 } | 636 } |
629 if (fData.get()) { | 637 if (fData.get()) { |
630 return fData->opCount(); | 638 return fData->opCount(); |
631 } | 639 } |
632 return 0; | 640 return 0; |
633 } | 641 } |
OLD | NEW |