Updated the get_images_from_skps tool to check for ICC profile support
Tool will now check for and output all unsuccessfully parsed ICC
profiles in input sksp images if --testColorCorrectionSupported is set
as a flag. All ICC-aware codecs had to be slightly modified in order to
expose this information, as the logic for accessing the ICC profiles is
all within the codecs. If --writeFailedImages is set, it will also
output all images whoses ICC profiles were not supported.
TBR=reed@google.com
BUG=skia:
Change-Id: Ic310d82bdebf92f8d3bc0ad3dcc688136b6de377
Reviewed-on: https://skia-review.googlesource.com/5355
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Robert Aftias <raftias@google.com>
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index 09913c7..dbc141e 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -62,10 +62,13 @@
WebPChunkIterator chunkIterator;
SkAutoTCallVProc<WebPChunkIterator, WebPDemuxReleaseChunkIterator> autoCI(&chunkIterator);
sk_sp<SkColorSpace> colorSpace = nullptr;
+ bool unsupportedICC = false;
if (WebPDemuxGetChunk(demux, "ICCP", 1, &chunkIterator)) {
colorSpace = SkColorSpace::MakeICC(chunkIterator.chunk.bytes, chunkIterator.chunk.size);
+ if (!colorSpace) {
+ unsupportedICC = true;
+ }
}
-
if (!colorSpace) {
colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
}
@@ -140,8 +143,11 @@
}
SkEncodedInfo info = SkEncodedInfo::Make(color, alpha, 8);
- return new SkWebpCodec(features.width, features.height, info, std::move(colorSpace),
- streamDeleter.release(), demux.release(), std::move(data));
+ SkWebpCodec* codecOut = new SkWebpCodec(features.width, features.height, info,
+ std::move(colorSpace), streamDeleter.release(),
+ demux.release(), std::move(data));
+ codecOut->setUnsupportedICC(unsupportedICC);
+ return codecOut;
}
SkISize SkWebpCodec::onGetScaledDimensions(float desiredScale) const {