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

Unified Diff: src/codec/SkCodec_libpng.h

Issue 1365313002: Merge SkCodec with SkScanlineDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Skip ICO in SkScaledCodec for now Created 5 years, 3 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_libgif.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 e8807499ea74419a7e81535a01c44af589f24466..8ef1ae2c17d3ed2e39f64cce2032f868b4f9030e 100644
--- a/src/codec/SkCodec_libpng.h
+++ b/src/codec/SkCodec_libpng.h
@@ -36,7 +36,31 @@ 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; }
+ SkSwizzler* swizzler() { return fSwizzler; }
+ SkSwizzler::SrcConfig srcConfig() const { return fSrcConfig; }
+ int numberPasses() const { return fNumberPasses; }
+
+ enum AlphaState {
+ // 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 +71,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;
};
« no previous file with comments | « src/codec/SkCodec_libgif.cpp ('k') | src/codec/SkCodec_libpng.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698