OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include <new> | 7 #include <new> |
8 #include "SkImageGenerator.h" | 8 #include "SkImageGenerator.h" |
9 #include "SkPictureData.h" | 9 #include "SkPictureData.h" |
10 #include "SkPictureRecord.h" | 10 #include "SkPictureRecord.h" |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 SkPicture::InstallPixelRefProc pr
oc, | 552 SkPicture::InstallPixelRefProc pr
oc, |
553 SkTypefacePlayback* topLevelTFPla
yback) { | 553 SkTypefacePlayback* topLevelTFPla
yback) { |
554 SkAutoTDelete<SkPictureData> data(new SkPictureData(info)); | 554 SkAutoTDelete<SkPictureData> data(new SkPictureData(info)); |
555 if (!topLevelTFPlayback) { | 555 if (!topLevelTFPlayback) { |
556 topLevelTFPlayback = &data->fTFPlayback; | 556 topLevelTFPlayback = &data->fTFPlayback; |
557 } | 557 } |
558 | 558 |
559 if (!data->parseStream(stream, proc, topLevelTFPlayback)) { | 559 if (!data->parseStream(stream, proc, topLevelTFPlayback)) { |
560 return nullptr; | 560 return nullptr; |
561 } | 561 } |
562 return data.detach(); | 562 return data.release(); |
563 } | 563 } |
564 | 564 |
565 SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer, | 565 SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer, |
566 const SkPictInfo& info) { | 566 const SkPictInfo& info) { |
567 SkAutoTDelete<SkPictureData> data(new SkPictureData(info)); | 567 SkAutoTDelete<SkPictureData> data(new SkPictureData(info)); |
568 buffer.setVersion(info.fVersion); | 568 buffer.setVersion(info.fVersion); |
569 | 569 |
570 if (!data->parseBuffer(buffer)) { | 570 if (!data->parseBuffer(buffer)) { |
571 return nullptr; | 571 return nullptr; |
572 } | 572 } |
573 return data.detach(); | 573 return data.release(); |
574 } | 574 } |
575 | 575 |
576 bool SkPictureData::parseStream(SkStream* stream, | 576 bool SkPictureData::parseStream(SkStream* stream, |
577 SkPicture::InstallPixelRefProc proc, | 577 SkPicture::InstallPixelRefProc proc, |
578 SkTypefacePlayback* topLevelTFPlayback) { | 578 SkTypefacePlayback* topLevelTFPlayback) { |
579 for (;;) { | 579 for (;;) { |
580 uint32_t tag = stream->readU32(); | 580 uint32_t tag = stream->readU32(); |
581 if (SK_PICT_EOF_TAG == tag) { | 581 if (SK_PICT_EOF_TAG == tag) { |
582 break; | 582 break; |
583 } | 583 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 625 } |
626 } | 626 } |
627 | 627 |
628 bool SkPictureData::suitableForLayerOptimization() const { | 628 bool SkPictureData::suitableForLayerOptimization() const { |
629 return fContentInfo.numLayers() > 0; | 629 return fContentInfo.numLayers() > 0; |
630 } | 630 } |
631 #endif | 631 #endif |
632 /////////////////////////////////////////////////////////////////////////////// | 632 /////////////////////////////////////////////////////////////////////////////// |
633 | 633 |
634 | 634 |
OLD | NEW |