Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: include/codec/SkCodec.h

Issue 2447863002: Report repetition count in SkCodec (Closed)
Patch Set: Make colorTables.gif use a different loop count Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | resources/colorTables.gif » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 /** 607 /**
608 * Return info about the frames in the image. 608 * Return info about the frames in the image.
609 * 609 *
610 * May require reading through the stream to determine the number of 610 * May require reading through the stream to determine info about the
611 * frames. 611 * frames (including the count).
612 * 612 *
613 * As such, future decoding calls may require a rewind. 613 * As such, future decoding calls may require a rewind.
614 * 614 *
615 * For single-frame images, this will return an empty vector. 615 * For single-frame images, this will return an empty vector.
616 */ 616 */
617 std::vector<FrameInfo> getFrameInfo() { 617 std::vector<FrameInfo> getFrameInfo() {
618 return this->onGetFrameInfo(); 618 return this->onGetFrameInfo();
619 } 619 }
620 620
621 static constexpr int kRepetitionCountInfinite = -1;
622
623 /**
624 * Return the number of times to repeat, if this image is animated.
625 *
626 * May require reading the stream to find the repetition count.
627 *
628 * As such, future decoding calls may require a rewind.
629 *
630 * For single-frame images, this will return 0.
631 */
632 int getRepetitionCount() {
633 return this->onGetRepetitionCount();
634 }
635
621 protected: 636 protected:
622 /** 637 /**
623 * Takes ownership of SkStream* 638 * Takes ownership of SkStream*
624 */ 639 */
625 SkCodec(int width, 640 SkCodec(int width,
626 int height, 641 int height,
627 const SkEncodedInfo&, 642 const SkEncodedInfo&,
628 SkStream*, 643 SkStream*,
629 sk_sp<SkColorSpace>, 644 sk_sp<SkColorSpace>,
630 Origin = kTopLeft_Origin); 645 Origin = kTopLeft_Origin);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 virtual int onOutputScanline(int inputScanline) const; 774 virtual int onOutputScanline(int inputScanline) const;
760 775
761 bool initializeColorXform(const SkImageInfo& dstInfo); 776 bool initializeColorXform(const SkImageInfo& dstInfo);
762 SkColorSpaceXform* colorXform() const { return fColorXform.get(); } 777 SkColorSpaceXform* colorXform() const { return fColorXform.get(); }
763 778
764 virtual std::vector<FrameInfo> onGetFrameInfo() { 779 virtual std::vector<FrameInfo> onGetFrameInfo() {
765 // empty vector - this is not animated. 780 // empty vector - this is not animated.
766 return {}; 781 return {};
767 } 782 }
768 783
784 virtual int onGetRepetitionCount() {
785 return 0;
786 }
787
769 /** 788 /**
770 * Used for testing with qcms. 789 * Used for testing with qcms.
771 * FIXME: Remove this when we are done comparing with qcms. 790 * FIXME: Remove this when we are done comparing with qcms.
772 */ 791 */
773 virtual sk_sp<SkData> getICCData() const { return nullptr; } 792 virtual sk_sp<SkData> getICCData() const { return nullptr; }
774 793
775 private: 794 private:
776 const SkEncodedInfo fEncodedInfo; 795 const SkEncodedInfo fEncodedInfo;
777 const SkImageInfo fSrcInfo; 796 const SkImageInfo fSrcInfo;
778 std::unique_ptr<SkStream> fStream; 797 std::unique_ptr<SkStream> fStream;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 // For testing with qcms 870 // For testing with qcms
852 // FIXME: Remove these when we are done comparing with qcms. 871 // FIXME: Remove these when we are done comparing with qcms.
853 friend class DM::ColorCodecSrc; 872 friend class DM::ColorCodecSrc;
854 friend class ColorCodecBench; 873 friend class ColorCodecBench;
855 874
856 friend class DM::CodecSrc; // for fillIncompleteImage 875 friend class DM::CodecSrc; // for fillIncompleteImage
857 friend class SkSampledCodec; 876 friend class SkSampledCodec;
858 friend class SkIcoCodec; 877 friend class SkIcoCodec;
859 }; 878 };
860 #endif // SkCodec_DEFINED 879 #endif // SkCodec_DEFINED
OLDNEW
« no previous file with comments | « no previous file | resources/colorTables.gif » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698