Chromium Code Reviews| Index: src/codec/SkJpegCodec.h |
| diff --git a/src/codec/SkJpegCodec.h b/src/codec/SkJpegCodec.h |
| index 7aa275ce4efd6028b69eb48d10de69e8a03a6f9b..7eb5100a8fadcfbd811aad5386c13426b56f20cf 100644 |
| --- a/src/codec/SkJpegCodec.h |
| +++ b/src/codec/SkJpegCodec.h |
| @@ -10,6 +10,7 @@ |
| #include "SkCodec.h" |
| #include "SkColorSpace.h" |
| +#include "SkColorSpaceXform.h" |
| #include "SkImageInfo.h" |
| #include "SkSwizzler.h" |
| #include "SkStream.h" |
| @@ -99,34 +100,46 @@ private: |
| /* |
| * Checks if the conversion between the input image and the requested output |
| - * image has been implemented |
| - * Sets the output color space |
| + * image has been implemented. |
| + * |
| + * Sets the output color space. |
| */ |
| - bool setOutputColorSpace(const SkImageInfo& dst); |
| + bool setOutputColorSpace(const SkImageInfo& dst, bool needsColorXform); |
| - // scanline decoding |
| void initializeSwizzler(const SkImageInfo& dstInfo, const Options& options); |
| + bool initializeColorXform(const SkImageInfo& dstInfo, bool needsColorXform); |
| + void allocateStorage(const SkImageInfo& dstInfo); |
| + int readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, int count); |
| + |
| + /* |
| + * Scanline decoding. |
| + */ |
| SkSampler* getSampler(bool createIfNecessary) override; |
| Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& options, |
| SkPMColor ctable[], int* ctableCount) override; |
| int onGetScanlines(void* dst, int count, size_t rowBytes) override; |
| bool onSkipScanlines(int count) override; |
| - SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; |
| + SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; |
| + |
| // We will save the state of the decompress struct after reading the header. |
| // This allows us to safely call onGetScaledDimensions() at any time. |
| - const int fReadyState; |
| + const int fReadyState; |
| + |
| + |
| + SkAutoTMalloc<uint8_t> fStorage; |
| + uint8_t* fSwizzleSrcRow; |
| + uint32_t* fColorXformSrcRow; |
|
mtklein
2016/07/28 19:45:26
Do we make sure the uint32_t* is 4 byte aligned in
msarett
2016/07/28 20:09:45
Should be fine because we always decode to RGBA (m
|
| - // scanline decoding |
| - SkAutoTMalloc<uint8_t> fStorage; // Only used if sampling is needed |
| - uint8_t* fSrcRow; // Only used if sampling is needed |
| // libjpeg-turbo provides some subsetting. In the case that libjpeg-turbo |
| // cannot take the exact the subset that we need, we will use the swizzler |
| // to further subset the output from libjpeg-turbo. |
| - SkIRect fSwizzlerSubset; |
| - SkAutoTDelete<SkSwizzler> fSwizzler; |
| + SkIRect fSwizzlerSubset; |
| + |
| + SkAutoTDelete<SkSwizzler> fSwizzler; |
| + std::unique_ptr<SkColorSpaceXform> fColorXform; |
| - sk_sp<SkData> fICCData; |
| + sk_sp<SkData> fICCData; |
| typedef SkCodec INHERITED; |
| }; |