diff options
author | 2016-10-20 12:35:23 -0400 | |
---|---|---|
committer | 2016-10-20 17:31:35 +0000 | |
commit | 313c4635e3f1005e6807f5b0ad52805f30902d66 (patch) | |
tree | 4e1580f7246f70fa7235982e6d17ec0461f8ad6a /dm | |
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 'dm')
-rw-r--r-- | dm/DMSrcSink.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 8b62864c8f..a38b96ee5a 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -941,15 +941,11 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const { size_t rowBytes = bitmap.rowBytes(); SkCodec::Result r = codec->getPixels(decodeInfo, bitmap.getPixels(), rowBytes); if (SkCodec::kSuccess != r && SkCodec::kIncompleteInput != r) { - if (kRGBA_F16_SkColorType == decodeInfo.colorType()) { - // FIXME (raftias): - // Get the codecs to not fail when there is no color xform, - // which currently happens in F16 mode. - return Error::Nonfatal(SkStringPrintf("Couldn't getPixels %s in F16. Error code %d", - fPath.c_str())); - } else { - return SkStringPrintf("Couldn't getPixels %s. Error code %d", fPath.c_str(), r); - } + // FIXME (raftias): + // This should be a fatal error. We need to add support for + // A2B images in SkColorSpaceXform. + return Error::Nonfatal(SkStringPrintf("Couldn't getPixels %s. Error code %d", + fPath.c_str(), r)); } switch (fMode) { |