Chromium Code Reviews| Index: src/codec/SkCodec_libpng.h |
| diff --git a/src/codec/SkCodec_libpng.h b/src/codec/SkCodec_libpng.h |
| index debb14b882b8914d96011c1822afc0bcc7a9e600..58166caa39b27c0677a801bd27b97e6f6fa24b2a 100644 |
| --- a/src/codec/SkCodec_libpng.h |
| +++ b/src/codec/SkCodec_libpng.h |
| @@ -7,14 +7,16 @@ |
| #include "SkCodec.h" |
| #include "SkEncodedFormat.h" |
| +#include "SkColorTable.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 fSc; |
|
djsollen
2015/03/25 13:08:42
I had a hard time remembering the meaning of this
scroggo
2015/03/25 13:49:15
Done.
|
| + 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; |
| }; |