@@ -32,16 +32,78 @@ class SkCodecImageGenerator : public SkImageGenerator {
32
32
*/
33
33
SkISize getScaledDimensions (float desiredScale) const ;
34
34
35
+ /* *
36
+ * Decode into the given pixels, a block of memory of size at
37
+ * least (info.fHeight - 1) * rowBytes + (info.fWidth *
38
+ * bytesPerPixel)
39
+ *
40
+ * Repeated calls to this function should give the same results,
41
+ * allowing the PixelRef to be immutable.
42
+ *
43
+ * @param info A description of the format
44
+ * expected by the caller. This can simply be identical
45
+ * to the info returned by getInfo().
46
+ *
47
+ * This contract also allows the caller to specify
48
+ * different output-configs, which the implementation can
49
+ * decide to support or not.
50
+ *
51
+ * A size that does not match getInfo() implies a request
52
+ * to scale. If the generator cannot perform this scale,
53
+ * it will return false.
54
+ *
55
+ * @return true on success.
56
+ */
57
+ bool getPixels (const SkImageInfo& info, void * pixels, size_t rowBytes, const SkCodec::Options* options = nullptr );
58
+
59
+ /* *
60
+ * Return the number of frames in the image.
61
+ *
62
+ * May require reading through the stream.
63
+ */
64
+ int getFrameCount () { return fCodec ->getFrameCount (); }
65
+
66
+ /* *
67
+ * Return info about a single frame.
68
+ *
69
+ * Only supported by multi-frame images. Does not read through the stream,
70
+ * so it should be called after getFrameCount() to parse any frames that
71
+ * have not already been parsed.
72
+ */
73
+ bool getFrameInfo (int index, SkCodec::FrameInfo* info) const {
74
+ return fCodec ->getFrameInfo (index , info);
75
+ }
76
+
77
+ /* *
78
+ * Return the number of times to repeat, if this image is animated. This number does not
79
+ * include the first play through of each frame. For example, a repetition count of 4 means
80
+ * that each frame is played 5 times and then the animation stops.
81
+ *
82
+ * It can return kRepetitionCountInfinite, a negative number, meaning that the animation
83
+ * should loop forever.
84
+ *
85
+ * May require reading the stream to find the repetition count.
86
+ *
87
+ * As such, future decoding calls may require a rewind.
88
+ *
89
+ * For still (non-animated) image codecs, this will return 0.
90
+ */
91
+ int getRepetitionCount () { return fCodec ->getRepetitionCount (); }
92
+
35
93
protected:
36
94
sk_sp<SkData> onRefEncodedData () override ;
37
95
38
- bool onGetPixels (
39
- const SkImageInfo& info, void * pixels, size_t rowBytes, const Options& opts) override ;
96
+ bool onGetPixels (const SkImageInfo& info,
97
+ void * pixels,
98
+ size_t rowBytes,
99
+ const Options& opts) override ;
40
100
41
- bool onQueryYUVA8 (
42
- SkYUVASizeInfo*, SkYUVAIndex[SkYUVAIndex::kIndexCount ], SkYUVColorSpace*) const override ;
101
+ bool onQueryYUVA8 (SkYUVASizeInfo*,
102
+ SkYUVAIndex[SkYUVAIndex::kIndexCount ],
103
+ SkYUVColorSpace*) const override ;
43
104
44
- bool onGetYUVA8Planes (const SkYUVASizeInfo&, const SkYUVAIndex[SkYUVAIndex::kIndexCount ],
105
+ bool onGetYUVA8Planes (const SkYUVASizeInfo&,
106
+ const SkYUVAIndex[SkYUVAIndex::kIndexCount ],
45
107
void * planes[]) override ;
46
108
47
109
private:
0 commit comments