OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 7 |
8 #ifndef SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED |
9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED |
10 | 10 |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
597 * kNone. | 597 * kNone. |
598 */ | 598 */ |
599 size_t fRequiredFrame; | 599 size_t fRequiredFrame; |
600 | 600 |
601 /** | 601 /** |
602 * Number of milliseconds to show this frame. | 602 * Number of milliseconds to show this frame. |
603 */ | 603 */ |
604 size_t fDuration; | 604 size_t fDuration; |
605 }; | 605 }; |
606 | 606 |
607 static constexpr int kRepetitionCountInfinite = -1; | |
608 | |
607 /** | 609 /** |
608 * Return info about the frames in the image. | 610 * Return info about the frames in the image. |
609 * | 611 * |
610 * May require reading through the stream to determine the number of | 612 * May require reading through the stream to determine the number of |
611 * frames. | 613 * frames. |
612 * | 614 * |
613 * As such, future decoding calls may require a rewind. | 615 * As such, future decoding calls may require a rewind. |
614 * | 616 * |
615 * For single-frame images, this will return an empty vector. | 617 * For single-frame images, this will return an empty vector and leave |
618 * outRepetitionCount unmodified. | |
619 * | |
620 * @param outRepetitionCount If non-NULL, this will be set to the number of | |
621 * times an animated image should repeat. | |
616 */ | 622 */ |
617 std::vector<FrameInfo> getFrameInfo() { | 623 std::vector<FrameInfo> getFrameInfo(int* outRepetitionCount = nullptr) { |
cblume
2016/10/26 17:45:59
I like where this is going.
I am pretty sure I wo
scroggo_chromium
2016/10/26 18:42:18
(I assume "more buffers" means "more data"?) Yes,
scroggo_chromium
2016/10/27 20:54:16
patch set 2 returns a bool, and uses multiple out
cblume
2016/10/28 01:09:41
patch set 2's solution would allow us to reuse all
cblume
2016/10/28 01:09:41
Actually, I may have said this wrong.
I definitel
scroggo_chromium
2016/10/28 11:49:40
I still think you always want the FrameInfo when y
| |
618 return this->onGetFrameInfo(); | 624 return this->onGetFrameInfo(outRepetitionCount); |
619 } | 625 } |
620 | 626 |
621 protected: | 627 protected: |
622 /** | 628 /** |
623 * Takes ownership of SkStream* | 629 * Takes ownership of SkStream* |
624 */ | 630 */ |
625 SkCodec(int width, | 631 SkCodec(int width, |
626 int height, | 632 int height, |
627 const SkEncodedInfo&, | 633 const SkEncodedInfo&, |
628 SkStream*, | 634 SkStream*, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
754 * | 760 * |
755 * Returns -1 if we have not started a scanline decode. | 761 * Returns -1 if we have not started a scanline decode. |
756 */ | 762 */ |
757 int currScanline() const { return fCurrScanline; } | 763 int currScanline() const { return fCurrScanline; } |
758 | 764 |
759 virtual int onOutputScanline(int inputScanline) const; | 765 virtual int onOutputScanline(int inputScanline) const; |
760 | 766 |
761 bool initializeColorXform(const SkImageInfo& dstInfo); | 767 bool initializeColorXform(const SkImageInfo& dstInfo); |
762 SkColorSpaceXform* colorXform() const { return fColorXform.get(); } | 768 SkColorSpaceXform* colorXform() const { return fColorXform.get(); } |
763 | 769 |
764 virtual std::vector<FrameInfo> onGetFrameInfo() { | 770 virtual std::vector<FrameInfo> onGetFrameInfo(int*) { |
765 // empty vector - this is not animated. | 771 // empty vector - this is not animated. |
766 return {}; | 772 return {}; |
767 } | 773 } |
768 | 774 |
769 /** | 775 /** |
770 * Used for testing with qcms. | 776 * Used for testing with qcms. |
771 * FIXME: Remove this when we are done comparing with qcms. | 777 * FIXME: Remove this when we are done comparing with qcms. |
772 */ | 778 */ |
773 virtual sk_sp<SkData> getICCData() const { return nullptr; } | 779 virtual sk_sp<SkData> getICCData() const { return nullptr; } |
774 | 780 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
851 // For testing with qcms | 857 // For testing with qcms |
852 // FIXME: Remove these when we are done comparing with qcms. | 858 // FIXME: Remove these when we are done comparing with qcms. |
853 friend class DM::ColorCodecSrc; | 859 friend class DM::ColorCodecSrc; |
854 friend class ColorCodecBench; | 860 friend class ColorCodecBench; |
855 | 861 |
856 friend class DM::CodecSrc; // for fillIncompleteImage | 862 friend class DM::CodecSrc; // for fillIncompleteImage |
857 friend class SkSampledCodec; | 863 friend class SkSampledCodec; |
858 friend class SkIcoCodec; | 864 friend class SkIcoCodec; |
859 }; | 865 }; |
860 #endif // SkCodec_DEFINED | 866 #endif // SkCodec_DEFINED |
OLD | NEW |