Commit 56adc578 authored by Brian Osman's avatar Brian Osman Committed by Commit Bot

Reject ICC profiles with a non-D50 white point

This now matches behavior from before m68 (when we used
a different ICC parser that rejected these profiles).

In the longer term, I'd like to evaluate what Windows
is doing with these profiles (ignoring them, or white
point correcting them).

Bug: chromium:847024
Change-Id: I662ea9217423d5c9a922ba1735d9de627133de12
Reviewed-on: https://chromium-review.googlesource.com/1150677Reviewed-by: default avatarccameron <ccameron@chromium.org>
Reviewed-by: default avatarMike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Cr-Commit-Position: refs/heads/master@{#578354}
parent 4480bf47
...@@ -90,6 +90,24 @@ ICCProfile::Internals::AnalyzeResult ICCProfile::Internals::Initialize() { ...@@ -90,6 +90,24 @@ ICCProfile::Internals::AnalyzeResult ICCProfile::Internals::Initialize() {
return kICCFailedToMakeUsable; return kICCFailedToMakeUsable;
} }
// We have seen many users with profiles that don't have a D50 white point.
// Windows appears to detect these profiles, and not use them for OS drawing.
// It still returns them when we query the system for the installed profile.
// For consistency (and to match old behavior) we reject these profiles on
// all platforms.
// https://crbug.com/847024
const skcms_Matrix3x3& m(profile.toXYZD50);
float wX = m.vals[0][0] + m.vals[0][1] + m.vals[0][2];
float wY = m.vals[1][0] + m.vals[1][1] + m.vals[1][2];
float wZ = m.vals[2][0] + m.vals[2][1] + m.vals[2][2];
static const float kD50_WhitePoint[3] = { 0.96420f, 1.00000f, 0.82491f };
if (fabsf(wX - kD50_WhitePoint[0]) > 0.04f ||
fabsf(wY - kD50_WhitePoint[1]) > 0.04f ||
fabsf(wZ - kD50_WhitePoint[2]) > 0.04f) {
return kICCFailedToParse;
}
// Create an SkColorSpace from the profile. This should always succeed after // Create an SkColorSpace from the profile. This should always succeed after
// calling MakeUsableAsDestinationWithSingleCurve. // calling MakeUsableAsDestinationWithSingleCurve.
sk_color_space_ = SkColorSpace::Make(profile); sk_color_space_ = SkColorSpace::Make(profile);
......
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