Index: src/codec/SkCodec_libpng.h |
diff --git a/src/codec/SkCodec_libpng.h b/src/codec/SkCodec_libpng.h |
index debb14b882b8914d96011c1822afc0bcc7a9e600..fa7b39d82fdb497527a47b2d0d6a4fe2abbabf1b 100644 |
--- a/src/codec/SkCodec_libpng.h |
+++ b/src/codec/SkCodec_libpng.h |
@@ -6,15 +6,17 @@ |
*/ |
#include "SkCodec.h" |
+#include "SkColorTable.h" |
#include "SkEncodedFormat.h" |
#include "SkImageInfo.h" |
+#include "SkRefCnt.h" |
+#include "SkSwizzler.h" |
extern "C" { |
- // FIXME: I'd like to force all platforms to use the same decoder, but this |
- // means an extra dependency on Mac/Win. |
#include "png.h" |
} |
+class SkScanlineDecoder; |
class SkStream; |
class SkPngCodec : public SkCodec { |
@@ -26,12 +28,30 @@ protected: |
Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMColor*, int*) |
SK_OVERRIDE; |
SkEncodedFormat onGetEncodedFormat() const SK_OVERRIDE { return kPNG_SkEncodedFormat; } |
+ SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo) SK_OVERRIDE; |
+ bool onReallyHasAlpha() const SK_OVERRIDE { return fReallyHasAlpha; } |
private: |
- png_structp fPng_ptr; |
- png_infop fInfo_ptr; |
+ png_structp fPng_ptr; |
+ png_infop fInfo_ptr; |
+ |
+ // These are stored here so they can be used both by normal decoding and scanline decoding. |
+ SkAutoTUnref<SkColorTable> fColorTable; // May be unpremul. |
+ SkAutoTDelete<SkSwizzler> fSwizzler; |
+ |
+ SkSwizzler::SrcConfig fSrcConfig; |
+ int fNumberPasses; |
+ bool fReallyHasAlpha; |
SkPngCodec(const SkImageInfo&, SkStream*, png_structp, png_infop); |
~SkPngCodec(); |
+ // Helper to set up swizzler and color table. Also calls png_read_update_info. |
+ Result initializeSwizzler(const SkImageInfo& requestedInfo, void* dst, |
+ size_t rowBytes, const Options&); |
+ bool decodePalette(bool premultiply); |
+ void finish(); |
+ |
+ friend class SkPngScanlineDecoder; |
+ |
typedef SkCodec INHERITED; |
}; |