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

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: Cleanups 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
Index: src/codec/SkCodec_libpng.h
diff --git a/src/codec/SkCodec_libpng.h b/src/codec/SkCodec_libpng.h
index a5327dda4155afc7085583148e661b3780e1cca0..fc29488eaae68fb9e2a15c9553f265a7695ae16f 100644
--- a/src/codec/SkCodec_libpng.h
+++ b/src/codec/SkCodec_libpng.h
@@ -6,14 +6,16 @@
*/
#include "SkCodec.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 {
@@ -23,12 +25,30 @@ public:
static bool IsPng(SkStream*);
protected:
Result onGetPixels(const SkImageInfo&, void*, size_t, SkPMColor*, int*) SK_OVERRIDE;
+ SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo,
+ const SkIRect& origSubset) 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;
+ 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);
+ bool decodePalette(bool premultiply);
+ Result finish();
+
+ friend class SkPngScanlineDecoder;
+
typedef SkCodec INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698