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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 * This object is owned by the SkCodec, which will handle its lifetime. The | 63 * This object is owned by the SkCodec, which will handle its lifetime. The |
64 * returned object is only valid until the SkCodec is deleted or the next | 64 * returned object is only valid until the SkCodec is deleted or the next |
65 * call to getScanlineDecoder, whichever comes first. | 65 * call to getScanlineDecoder, whichever comes first. |
66 * | 66 * |
67 * Calling a second time will rewind and replace the existing one with a | 67 * Calling a second time will rewind and replace the existing one with a |
68 * new one. If the stream cannot be rewound, this will delete the existing | 68 * new one. If the stream cannot be rewound, this will delete the existing |
69 * one and return NULL. | 69 * one and return NULL. |
70 * | 70 * |
71 * @param dstInfo Info of the destination. If the dimensions do not match | 71 * @param dstInfo Info of the destination. If the dimensions do not match |
72 * those of getInfo, this implies a scale. | 72 * those of getInfo, this implies a scale. |
73 * @param options Contains decoding options, including if memory is zero | |
74 * initialized. | |
75 * @param ctable A pointer to a color table. This color table will be | |
76 * populated if the png has a color palette and we ask to decode in | |
scroggo
2015/04/21 21:43:05
nit: "we ask to decode in" -> dstInfo.colorType()
msarett
2015/04/22 14:32:52
Done.
| |
77 * kIndex8 mode. | |
78 * @param ctableCount A pointer to the size of the color table. Will be | |
79 * modified in kIndex8 mode if we have a color palette. | |
scroggo
2015/04/21 21:43:04
modified to what?
msarett
2015/04/22 14:32:52
Done.
| |
73 * @return New SkScanlineDecoder, or NULL on failure. | 80 * @return New SkScanlineDecoder, or NULL on failure. |
74 * | 81 * |
75 * NOTE: If any rows were previously decoded, this requires rewinding the | 82 * NOTE: If any rows were previously decoded, this requires rewinding the |
76 * SkStream. | 83 * SkStream. |
77 * | 84 * |
78 * NOTE: The scanline decoder is owned by the SkCodec and will delete it | 85 * NOTE: The scanline decoder is owned by the SkCodec and will delete it |
79 * when the SkCodec is deleted. | 86 * when the SkCodec is deleted. |
80 */ | 87 */ |
81 SkScanlineDecoder* getScanlineDecoder(const SkImageInfo& dstInfo); | 88 SkScanlineDecoder* getScanlineDecoder(const SkImageInfo& dstInfo, const Opti ons* options, |
scroggo
2015/04/21 21:43:05
Should we have a version that does not take Option
msarett
2015/04/22 14:32:52
I have added this version.
| |
89 SkPMColor ctable[], int* ctableCount); | |
82 | 90 |
83 /** | 91 /** |
84 * Some images may initially report that they have alpha due to the format | 92 * Some images may initially report that they have alpha due to the format |
85 * of the encoded data, but then never use any colors which have alpha | 93 * of the encoded data, but then never use any colors which have alpha |
86 * less than 100%. This function can be called *after* decoding to | 94 * less than 100%. This function can be called *after* decoding to |
87 * determine if such an image truly had alpha. Calling it before decoding | 95 * determine if such an image truly had alpha. Calling it before decoding |
88 * is undefined. | 96 * is undefined. |
89 * FIXME: see skbug.com/3582. | 97 * FIXME: see skbug.com/3582. |
90 */ | 98 */ |
91 bool reallyHasAlpha() const { | 99 bool reallyHasAlpha() const { |
(...skipping 27 matching lines...) Expand all Loading... | |
119 virtual SkEncodedFormat onGetEncodedFormat() const = 0; | 127 virtual SkEncodedFormat onGetEncodedFormat() const = 0; |
120 | 128 |
121 /** | 129 /** |
122 * Override if your codec supports scanline decoding. | 130 * Override if your codec supports scanline decoding. |
123 * | 131 * |
124 * As in onGetPixels(), the implementation must call rewindIfNeeded() and | 132 * As in onGetPixels(), the implementation must call rewindIfNeeded() and |
125 * handle as appropriate. | 133 * handle as appropriate. |
126 * | 134 * |
127 * @param dstInfo Info of the destination. If the dimensions do not match | 135 * @param dstInfo Info of the destination. If the dimensions do not match |
128 * those of getInfo, this implies a scale. | 136 * those of getInfo, this implies a scale. |
137 * @param options Contains decoding options, including if memory is zero | |
138 * initialized. | |
139 * @param ctable A pointer to a color table. This color table will be | |
140 * populated if the png has a color palette and we ask to decode in | |
scroggo
2015/04/21 21:43:05
same wording nit.
msarett
2015/04/22 14:32:52
Done.
| |
141 * kIndex8 mode. | |
142 * @param ctableCount A pointer to the size of the color table. Will be | |
143 * modified in kIndex8 mode if we have a color palette. | |
scroggo
2015/04/21 21:43:05
same question
msarett
2015/04/22 14:32:52
Done.
| |
129 * @return New SkScanlineDecoder on success, NULL otherwise. The SkCodec | 144 * @return New SkScanlineDecoder on success, NULL otherwise. The SkCodec |
130 * will take ownership of the returned scanline decoder. | 145 * will take ownership of the returned scanline decoder. |
131 */ | 146 */ |
132 virtual SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo) { | 147 virtual SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo, |
148 const Options& options, | |
149 SkPMColor ctable[], | |
150 int* ctableCount) { | |
133 return NULL; | 151 return NULL; |
134 } | 152 } |
135 | 153 |
136 virtual bool onReallyHasAlpha() const { return false; } | 154 virtual bool onReallyHasAlpha() const { return false; } |
137 | 155 |
138 enum RewindState { | 156 enum RewindState { |
139 kRewound_RewindState, | 157 kRewound_RewindState, |
140 kNoRewindNecessary_RewindState, | 158 kNoRewindNecessary_RewindState, |
141 kCouldNotRewind_RewindState | 159 kCouldNotRewind_RewindState |
142 }; | 160 }; |
(...skipping 26 matching lines...) Expand all Loading... | |
169 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO | 187 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
170 const SkImageInfo fInfo; | 188 const SkImageInfo fInfo; |
171 #endif // SK_SUPPORT_LEGACY_BOOL_ONGETINFO | 189 #endif // SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
172 SkAutoTDelete<SkStream> fStream; | 190 SkAutoTDelete<SkStream> fStream; |
173 bool fNeedsRewind; | 191 bool fNeedsRewind; |
174 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; | 192 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; |
175 | 193 |
176 typedef SkImageGenerator INHERITED; | 194 typedef SkImageGenerator INHERITED; |
177 }; | 195 }; |
178 #endif // SkCodec_DEFINED | 196 #endif // SkCodec_DEFINED |
OLD | NEW |