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 SkScanlineDecoder_DEFINED | 8 #ifndef SkScanlineDecoder_DEFINED |
9 #define SkScanlineDecoder_DEFINED | 9 #define SkScanlineDecoder_DEFINED |
10 | 10 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 * the scanline decoder. | 195 * the scanline decoder. |
196 */ | 196 */ |
197 SkScanlineOrder getScanlineOrder() const { return this->onGetScanlineOrder() ; } | 197 SkScanlineOrder getScanlineOrder() const { return this->onGetScanlineOrder() ; } |
198 | 198 |
199 /** | 199 /** |
200 * Returns the y-coordinate of the next row to be returned by the scanline | 200 * Returns the y-coordinate of the next row to be returned by the scanline |
201 * decoder. This will be overridden in the case of | 201 * decoder. This will be overridden in the case of |
202 * kOutOfOrder_SkScanlineOrder and should be unnecessary in the case of | 202 * kOutOfOrder_SkScanlineOrder and should be unnecessary in the case of |
203 * kNone_SkScanlineOrder. | 203 * kNone_SkScanlineOrder. |
204 */ | 204 */ |
205 int getY() const { | 205 int getY() { |
206 SkASSERT(kNone_SkScanlineOrder != this->getScanlineOrder()); | 206 SkASSERT(kNone_SkScanlineOrder != this->getScanlineOrder()); |
207 return this->onGetY(); | 207 return this->onGetY(); |
208 } | 208 } |
209 | 209 |
210 protected: | 210 protected: |
211 SkScanlineDecoder(const SkImageInfo& srcInfo) | 211 SkScanlineDecoder(const SkImageInfo& srcInfo) |
212 : fSrcInfo(srcInfo) | 212 : fSrcInfo(srcInfo) |
213 , fDstInfo() | 213 , fDstInfo() |
214 , fOptions() | 214 , fOptions() |
215 , fCurrScanline(0) {} | 215 , fCurrScanline(0) {} |
216 | 216 |
217 virtual SkISize onGetScaledDimensions(float /* desiredScale */) { | 217 virtual SkISize onGetScaledDimensions(float /* desiredScale */) { |
218 // By default, scaling is not supported. | 218 // By default, scaling is not supported. |
219 return this->getInfo().dimensions(); | 219 return this->getInfo().dimensions(); |
220 } | 220 } |
221 | 221 |
222 virtual SkEncodedFormat onGetEncodedFormat() const = 0; | 222 virtual SkEncodedFormat onGetEncodedFormat() const = 0; |
223 | 223 |
224 virtual bool onReallyHasAlpha() const { return false; } | 224 virtual bool onReallyHasAlpha() const { return false; } |
225 | 225 |
226 /** | 226 /** |
227 * Most images types will be kTopDown and will not need to override this fu nction. | 227 * Most images types will be kTopDown and will not need to override this fu nction. |
228 */ | 228 */ |
229 virtual SkScanlineOrder onGetScanlineOrder() const { return kTopDown_SkScanl ineOrder; } | 229 virtual SkScanlineOrder onGetScanlineOrder() const { return kTopDown_SkScanl ineOrder; } |
230 | 230 |
231 /** | 231 /** |
232 * Most images will be kTopDown and will not need to override this function . | 232 * Most images will be kTopDown and will not need to override this function . |
233 */ | 233 */ |
234 virtual int onGetY() const { return fCurrScanline; } | 234 virtual int onGetY() { return fCurrScanline; } |
msarett
2015/08/24 23:20:12
The current implementation of SkGifScanlineDecoder
scroggo
2015/08/27 16:35:49
FWIW, it does seem a little odd that it is not con
msarett
2015/09/01 17:50:15
Acknowledged.
| |
235 | 235 |
236 const SkImageInfo& dstInfo() const { return fDstInfo; } | 236 const SkImageInfo& dstInfo() const { return fDstInfo; } |
237 | 237 |
238 const SkCodec::Options& options() const { return fOptions; } | 238 const SkCodec::Options& options() const { return fOptions; } |
239 | 239 |
240 private: | 240 private: |
241 const SkImageInfo fSrcInfo; | 241 const SkImageInfo fSrcInfo; |
242 SkImageInfo fDstInfo; | 242 SkImageInfo fDstInfo; |
243 SkCodec::Options fOptions; | 243 SkCodec::Options fOptions; |
244 int fCurrScanline; | 244 int fCurrScanline; |
(...skipping 11 matching lines...) Expand all Loading... | |
256 // Calling the virtual method also means we do not double count | 256 // Calling the virtual method also means we do not double count |
257 // countLines. | 257 // countLines. |
258 return this->onGetScanlines(storage.get(), countLines, 0); | 258 return this->onGetScanlines(storage.get(), countLines, 0); |
259 } | 259 } |
260 | 260 |
261 virtual SkCodec::Result onGetScanlines(void* dst, int countLines, | 261 virtual SkCodec::Result onGetScanlines(void* dst, int countLines, |
262 size_t rowBytes) = 0; | 262 size_t rowBytes) = 0; |
263 | 263 |
264 }; | 264 }; |
265 #endif // SkScanlineDecoder_DEFINED | 265 #endif // SkScanlineDecoder_DEFINED |
OLD | NEW |