Commit 24721cda authored by Brian Osman's avatar Brian Osman Committed by Commit Bot

Always use SkColorSpace::Make(skcms_ICCProfile&) to create fallback color space

This factory rejects profiles with non-invertible XYZ matrices.
The old code accepted those matrices, allowing the SkImage color
space to have such a matrix. That led to failures when attempting
to decode an image (and transform to that space).

Bug: chromium:850354
Change-Id: I37de7ece181eeee0d6e8a5b389e6a6abf95e1ad3
Reviewed-on: https://chromium-review.googlesource.com/1091144Reviewed-by: default avatarLeon Scroggins <scroggo@chromium.org>
Reviewed-by: default avatarMike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Cr-Commit-Position: refs/heads/master@{#565394}
parent 05d5cec5
......@@ -586,10 +586,9 @@ sk_sp<SkColorSpace> ImageDecoder::ColorSpaceForSkImages() {
// we xform at decode time.
if (!color_space_for_sk_images_ && profile->has_toXYZD50) {
// Preserve the gamut, but convert to a standard transfer function.
SkMatrix44 to_xyz_d50(SkMatrix44::kUninitialized_Constructor);
to_xyz_d50.set3x3RowMajorf(&profile->toXYZD50.vals[0][0]);
color_space_for_sk_images_ = SkColorSpace::MakeRGB(
SkColorSpace::kSRGB_RenderTargetGamma, to_xyz_d50);
skcms_ICCProfile with_srgb = *profile;
skcms_SetTransferFunction(&with_srgb, skcms_sRGB_TransferFunction());
color_space_for_sk_images_ = SkColorSpace::Make(with_srgb);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment