aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkColorSpace.cpp
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2016-12-01 14:40:15 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-02 19:37:42 +0000
commitc2881e9b404d757cb26a1c68ed9c8a51ddd36f6b (patch)
tree40c6cde15aa192f200dd602c203d5832c8c7f62d /src/core/SkColorSpace.cpp
parent439ace939b6aaa58408ece0e9e89b633353571ae (diff)
Refine constant sRGB and Adobe RGB to D50 matrices
The new values are calculated starting with the "true" values, adapted to D50 using the Bradford transform. I don't remember where the old values came from, they've been around forever. It's possible that I just typed in the values that came out of ICC profiles (these would have been imperfect, given that there's a fixed-point -> float conversion happening there). BUG=skia: Change-Id: I8e870266bc8ab5372c3ccf6a5ee6691b2915af43 Reviewed-on: https://skia-review.googlesource.com/5450 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/core/SkColorSpace.cpp')
-rw-r--r--src/core/SkColorSpace.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp
index e9db37a810..54c85f1330 100644
--- a/src/core/SkColorSpace.cpp
+++ b/src/core/SkColorSpace.cpp
@@ -87,6 +87,7 @@ SkColorSpace_Base::SkColorSpace_Base(sk_sp<SkData> profileData)
: fProfileData(std::move(profileData))
{}
+#if defined(SK_USE_LEGACY_D50_MATRICES)
static constexpr float gSRGB_toXYZD50[] {
0.4358f, 0.3853f, 0.1430f, // Rx, Gx, Bx
0.2224f, 0.7170f, 0.0606f, // Ry, Gy, Gz
@@ -98,6 +99,19 @@ static constexpr float gAdobeRGB_toXYZD50[] {
0.3111f, 0.6257f, 0.0632f, // Ry, Gy, By
0.0195f, 0.0609f, 0.7448f, // Rz, Gz, Bz
};
+#else
+static constexpr float gSRGB_toXYZD50[] {
+ 0.4360747f, 0.3850649f, 0.1430804f, // Rx, Gx, Bx
+ 0.2225045f, 0.7168786f, 0.0606169f, // Ry, Gy, Gz
+ 0.0139322f, 0.0971045f, 0.7141733f, // Rz, Gz, Bz
+};
+
+static constexpr float gAdobeRGB_toXYZD50[] {
+ 0.6097559f, 0.2052401f, 0.1492240f, // Rx, Gx, Bx
+ 0.3111242f, 0.6256560f, 0.0632197f, // Ry, Gy, Gz
+ 0.0194811f, 0.0608902f, 0.7448387f, // Rz, Gz, Bz
+};
+#endif
/**
* Checks if our toXYZ matrix is a close match to a known color gamut.