Chromium Code Reviews| 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 false and leave the out |
| 618 * parameters unmodified. | |
| 619 * | |
| 620 * @param outFrameInfo vector of info about each frame. | |
| 621 * @param outRepetitionCount If non-NULL, this will be set to the number of | |
| 622 * times an animated image should repeat. | |
|
reed1
2016/10/31 14:17:01
Assuming this can take nullptr for outFrameInfo, t
scroggo
2016/10/31 19:12:27
I've updated the header, and updated the test to c
| |
| 616 */ | 623 */ |
| 617 std::vector<FrameInfo> getFrameInfo() { | 624 bool getFrameInfo(std::vector<FrameInfo>* outFrameInfo, int* outRepetitionCo unt) { |
| 618 return this->onGetFrameInfo(); | 625 return this->onGetFrameInfo(outFrameInfo, outRepetitionCount); |
| 619 } | 626 } |
| 620 | 627 |
| 621 protected: | 628 protected: |
| 622 /** | 629 /** |
| 623 * Takes ownership of SkStream* | 630 * Takes ownership of SkStream* |
| 624 */ | 631 */ |
| 625 SkCodec(int width, | 632 SkCodec(int width, |
| 626 int height, | 633 int height, |
| 627 const SkEncodedInfo&, | 634 const SkEncodedInfo&, |
| 628 SkStream*, | 635 SkStream*, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 754 * | 761 * |
| 755 * Returns -1 if we have not started a scanline decode. | 762 * Returns -1 if we have not started a scanline decode. |
| 756 */ | 763 */ |
| 757 int currScanline() const { return fCurrScanline; } | 764 int currScanline() const { return fCurrScanline; } |
| 758 | 765 |
| 759 virtual int onOutputScanline(int inputScanline) const; | 766 virtual int onOutputScanline(int inputScanline) const; |
| 760 | 767 |
| 761 bool initializeColorXform(const SkImageInfo& dstInfo); | 768 bool initializeColorXform(const SkImageInfo& dstInfo); |
| 762 SkColorSpaceXform* colorXform() const { return fColorXform.get(); } | 769 SkColorSpaceXform* colorXform() const { return fColorXform.get(); } |
| 763 | 770 |
| 764 virtual std::vector<FrameInfo> onGetFrameInfo() { | 771 virtual bool onGetFrameInfo(std::vector<FrameInfo>*, int*) { |
| 765 // empty vector - this is not animated. | 772 // default is not animated. |
| 766 return {}; | 773 return false; |
| 767 } | 774 } |
| 768 | 775 |
| 769 /** | 776 /** |
| 770 * Used for testing with qcms. | 777 * Used for testing with qcms. |
| 771 * FIXME: Remove this when we are done comparing with qcms. | 778 * FIXME: Remove this when we are done comparing with qcms. |
| 772 */ | 779 */ |
| 773 virtual sk_sp<SkData> getICCData() const { return nullptr; } | 780 virtual sk_sp<SkData> getICCData() const { return nullptr; } |
| 774 | 781 |
| 775 private: | 782 private: |
| 776 const SkEncodedInfo fEncodedInfo; | 783 const SkEncodedInfo fEncodedInfo; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 851 // For testing with qcms | 858 // For testing with qcms |
| 852 // FIXME: Remove these when we are done comparing with qcms. | 859 // FIXME: Remove these when we are done comparing with qcms. |
| 853 friend class DM::ColorCodecSrc; | 860 friend class DM::ColorCodecSrc; |
| 854 friend class ColorCodecBench; | 861 friend class ColorCodecBench; |
| 855 | 862 |
| 856 friend class DM::CodecSrc; // for fillIncompleteImage | 863 friend class DM::CodecSrc; // for fillIncompleteImage |
| 857 friend class SkSampledCodec; | 864 friend class SkSampledCodec; |
| 858 friend class SkIcoCodec; | 865 friend class SkIcoCodec; |
| 859 }; | 866 }; |
| 860 #endif // SkCodec_DEFINED | 867 #endif // SkCodec_DEFINED |
| OLD | NEW |