aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkColorSpacePriv.h
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-12-19 14:44:12 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-20 14:09:34 +0000
commita12f795f4ab4b97d31acfd8bfbbbb6e06a70e999 (patch)
treef3c132ed909a214ac67e3352f1f2d965d1a10dc9 /src/core/SkColorSpacePriv.h
parentb5086961f335d6757a88ce7507c445485aaba2e6 (diff)
Fix Adobe RGB color space in Skia
Our runtime definition of the XYZ matrix was fairly inaccurate. It also didn't round-trip through ICC fixed point correctly. Now, constructing the color space at runtime produces exactly the same matrix as constructing the space from the ICC profile. And the values can then be serialized back to ICC exactly. This eliminates the need for the snapping logic, too. Bug: skia: Change-Id: I69f4a9bfec3eeef153935e21ab3a0630794b1607 Reviewed-on: https://skia-review.googlesource.com/84840 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/core/SkColorSpacePriv.h')
-rw-r--r--src/core/SkColorSpacePriv.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/SkColorSpacePriv.h b/src/core/SkColorSpacePriv.h
index 64fe31fce3..b0a8c1dcbc 100644
--- a/src/core/SkColorSpacePriv.h
+++ b/src/core/SkColorSpacePriv.h
@@ -10,6 +10,7 @@
#include <math.h>
#include "SkColorSpace_Base.h"
+#include "SkFixed.h"
#define SkColorSpacePrintf(...)
@@ -20,9 +21,19 @@ static constexpr float gSRGB_toXYZD50[] {
};
static constexpr float gAdobeRGB_toXYZD50[] {
+#ifdef SK_SUPPORT_LEGACY_ADOBE_XYZ
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
+#else
+ // ICC fixed-point (16.16) repesentation of:
+ // 0.60974, 0.20528, 0.14919,
+ // 0.31111, 0.62567, 0.06322,
+ // 0.01947, 0.06087, 0.74457,
+ SkFixedToFloat(0x9c18), SkFixedToFloat(0x348d), SkFixedToFloat(0x2631), // Rx, Gx, Bx
+ SkFixedToFloat(0x4fa5), SkFixedToFloat(0xa02c), SkFixedToFloat(0x102f), // Ry, Gy, Gz
+ SkFixedToFloat(0x04fc), SkFixedToFloat(0x0f95), SkFixedToFloat(0xbe9c), // Rz, Gz, Bz
+#endif
};
static constexpr float gDCIP3_toXYZD50[] {