diff options
author | Matt Sarett <msarett@google.com> | 2016-10-20 12:35:23 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-20 17:31:35 +0000 |
commit | 313c4635e3f1005e6807f5b0ad52805f30902d66 (patch) | |
tree | 4e1580f7246f70fa7235982e6d17ec0461f8ad6a /include/codec | |
parent | ff6a07f4dedc67237cb26500d3617194a1ae5a9c (diff) |
Safely handle unsupported color xforms in SkCodec
(1) The transformation code *should* support any src SkColorSpace
that we successfully parse. This is agreed upon internally and
by clients. The fact that we currently don't is just a bug...
(2) We cannot and will not support all SkColorSpaces as dsts.
So if we fail to make a SkColorSpaceXform, we should assume that
it was caused by a bad dst color space. The correct response in
this case is to return kInvalidConversion. I've rewritten the CL
to do this.
The fact that weird src spaces will sometimes trigger a
kInvalidConversion is just a bug that is being actively worked on.
TBR=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3661
Change-Id: Iac2b45120507ec71b1b3d555c61931f7348dad9e
Reviewed-on: https://skia-review.googlesource.com/3661
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Robert Aftias <raftias@google.com>
Diffstat (limited to 'include/codec')
-rw-r--r-- | include/codec/SkCodec.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h index 363347dd72..153eaa9b42 100644 --- a/include/codec/SkCodec.h +++ b/include/codec/SkCodec.h @@ -19,6 +19,7 @@ #include "SkYUVSizeInfo.h" class SkColorSpace; +class SkColorSpaceXform; class SkData; class SkPngChunkReader; class SkSampler; @@ -706,25 +707,30 @@ protected: virtual int onOutputScanline(int inputScanline) const; + bool initializeColorXform(const SkImageInfo& dstInfo); + SkColorSpaceXform* colorXform() const { return fColorXform.get(); } + /** * Used for testing with qcms. * FIXME: Remove this when we are done comparing with qcms. */ virtual sk_sp<SkData> getICCData() const { return nullptr; } + private: - const SkEncodedInfo fEncodedInfo; - const SkImageInfo fSrcInfo; - SkAutoTDelete<SkStream> fStream; - bool fNeedsRewind; - const Origin fOrigin; + const SkEncodedInfo fEncodedInfo; + const SkImageInfo fSrcInfo; + SkAutoTDelete<SkStream> fStream; + bool fNeedsRewind; + const Origin fOrigin; - SkImageInfo fDstInfo; - SkCodec::Options fOptions; + SkImageInfo fDstInfo; + SkCodec::Options fOptions; + std::unique_ptr<SkColorSpaceXform> fColorXform; // Only meaningful during scanline decodes. - int fCurrScanline; + int fCurrScanline; - bool fStartedIncrementalDecode; + bool fStartedIncrementalDecode; /** * Return whether these dimensions are supported as a scale. |