Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Unified Diff: src/codec/SkCodec_libpng.h

Issue 1010903003: Add scanline decoding to SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Build with no-clobbered Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkCodec_libpng.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkCodec_libpng.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698