Index: src/codec/SkCodec_libpng.h |
diff --git a/src/codec/SkCodec_libpng.h b/src/codec/SkCodec_libpng.h |
index e8807499ea74419a7e81535a01c44af589f24466..f8194e5be50f51107078183adb587b54d3c4f80d 100644 |
--- a/src/codec/SkCodec_libpng.h |
+++ b/src/codec/SkCodec_libpng.h |
@@ -36,7 +36,33 @@ protected: |
override; |
SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedFormat; } |
bool onRewind() override; |
- bool onReallyHasAlpha() const override { return fReallyHasAlpha; } |
+ bool onReallyHasAlpha() const final; |
+ |
+ // Helper to set up swizzler and color table. Also calls png_read_update_info. |
+ Result initializeSwizzler(const SkImageInfo& requestedInfo, const Options&, |
+ SkPMColor*, int* ctableCount); |
+ |
+ SkPngCodec(const SkImageInfo&, SkStream*, png_structp, png_infop, int, int); |
+ |
+ png_structp png_ptr() { return fPng_ptr; } |
+ // FIXME: I think the subclass does not need this. |
+ //png_infop info_ptr() { return fInfo_ptr; } |
scroggo
2015/09/25 16:07:50
Will remove in next patch set.
|
+ SkSwizzler* swizzler() { return fSwizzler; } |
+ SkSwizzler::SrcConfig srcConfig() const { return fSrcConfig; } |
+ int numberPasses() const { return fNumberPasses; } |
+ |
+ enum AlphaState { |
msarett
2015/09/28 14:48:50
I think this is good.
Not in this CL, but maybe i
scroggo
2015/09/28 16:01:52
Yeah, no other codecs currently do any checking, b
|
+ // This class has done no decoding, or threw away its knowledge (in |
+ // scanline decodes). |
+ kUnknown_AlphaState, |
+ // This class found the image (possibly partial, in the case of a |
+ // scanline decode) to be opaque. |
+ kOpaque_AlphaState, |
+ // Ths class found the image to have alpha. |
+ kHasAlpha_AlphaState, |
+ }; |
+ |
+ virtual AlphaState alphaInScanlineDecode() const = 0; |
private: |
png_structp fPng_ptr; |
@@ -47,21 +73,13 @@ private: |
SkAutoTDelete<SkSwizzler> fSwizzler; |
SkSwizzler::SrcConfig fSrcConfig; |
- int fNumberPasses; |
- bool fReallyHasAlpha; |
+ const int fNumberPasses; |
int fBitDepth; |
- SkPngCodec(const SkImageInfo&, SkStream*, png_structp, png_infop, int); |
- |
- // Helper to set up swizzler and color table. Also calls png_read_update_info. |
- Result initializeSwizzler(const SkImageInfo& requestedInfo, const Options&, |
- SkPMColor*, int* ctableCount); |
+ AlphaState fAlphaState; |
bool decodePalette(bool premultiply, int* ctableCount); |
void destroyReadStruct(); |
- friend class SkPngScanlineDecoder; |
- friend class SkPngInterlacedScanlineDecoder; |
- |
typedef SkCodec INHERITED; |
}; |