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

Unified Diff: src/codec/SkPngCodec.h

Issue 2184543003: Perform color correction on png decodes (Closed) Base URL: https://skia.googlesource.com/skia.git@colorjpegs
Patch Set: Fixes Created 4 years, 4 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/SkJpegCodec.cpp ('k') | src/codec/SkPngCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkPngCodec.h
diff --git a/src/codec/SkPngCodec.h b/src/codec/SkPngCodec.h
index 0a8878395a967c7d7b4a8733b03447bcc1827107..69ecef1313d0e3d73105a6608f0f790aa97adad1 100644
--- a/src/codec/SkPngCodec.h
+++ b/src/codec/SkPngCodec.h
@@ -6,6 +6,7 @@
*/
#include "SkCodec.h"
+#include "SkColorSpaceXform.h"
#include "SkColorTable.h"
#include "SkPngChunkReader.h"
#include "SkEncodedFormat.h"
@@ -33,33 +34,38 @@ protected:
bool onRewind() override;
uint32_t onGetFillValue(SkColorType) const override;
- // Helper to set up swizzler and color table. Also calls png_read_update_info.
- Result initializeSwizzler(const SkImageInfo& requestedInfo, const Options&,
- SkPMColor*, int* ctableCount);
+ // Helper to set up swizzler, color xforms, and color table. Also calls png_read_update_info.
+ bool initializeXforms(const SkImageInfo& requestedInfo, const Options&, SkPMColor* colorPtr,
+ int* colorCount);
SkSampler* getSampler(bool createIfNecessary) override {
SkASSERT(fSwizzler);
return fSwizzler;
}
+ void allocateStorage(const SkImageInfo& dstInfo);
+
+ virtual int readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, int count,
+ int startRow) = 0;
SkPngCodec(int width, int height, const SkEncodedInfo&, SkStream*, SkPngChunkReader*,
png_structp, png_infop, int, int, sk_sp<SkColorSpace>);
- png_structp png_ptr() { return fPng_ptr; }
- SkSwizzler* swizzler() { return fSwizzler; }
- int numberPasses() const { return fNumberPasses; }
-
-private:
- SkAutoTUnref<SkPngChunkReader> fPngChunkReader;
- png_structp fPng_ptr;
- png_infop fInfo_ptr;
+ SkAutoTUnref<SkPngChunkReader> fPngChunkReader;
+ 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;
+ SkAutoTUnref<SkColorTable> fColorTable; // May be unpremul.
+ SkAutoTDelete<SkSwizzler> fSwizzler;
+ std::unique_ptr<SkColorSpaceXform> fColorXform;
+ SkAutoTMalloc<uint8_t> fStorage;
+ uint8_t* fSwizzlerSrcRow;
+ uint32_t* fColorXformSrcRow;
+ size_t fSrcRowBytes;
- const int fNumberPasses;
- int fBitDepth;
+ const int fNumberPasses;
+ int fBitDepth;
+private:
bool createColorTable(SkColorType dstColorType, bool premultiply, int* ctableCount);
void destroyReadStruct();
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | src/codec/SkPngCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698