diff options
author | brianosman <brianosman@google.com> | 2016-09-09 10:36:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-09 10:36:17 -0700 |
commit | de68d6c4616d86621373d88100002ddfdb9c08e3 (patch) | |
tree | c3020d0d2ab8a4157beeab02fc32efc1518bb1e6 /tools | |
parent | 81a478ca6c36aac3e53ce0373a281ac8940f4780 (diff) |
Fix storage of gamut transform matrices in SkColorSpace
We were effectively storing the transpose, which made all of our
operations on individual colors, and our concatenation of matrices
awkward and backwards.
I'm planning to push this further into Ganesh, where I had incorrectly
adjusted to the previous layout, treating colors as row vectors in the
shaders.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2324843003
Review-Url: https://codereview.chromium.org/2324843003
Diffstat (limited to 'tools')
-rw-r--r-- | tools/visualize_color_gamut.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/visualize_color_gamut.cpp b/tools/visualize_color_gamut.cpp index a0b8b82c65..cc15601b7d 100644 --- a/tools/visualize_color_gamut.cpp +++ b/tools/visualize_color_gamut.cpp @@ -32,15 +32,15 @@ static void load_gamut(SkPoint rgb[], const SkMatrix44& xyz) { // rx = rX / (rX + rY + rZ) // ry = rX / (rX + rY + rZ) // gx, gy, bx, and gy are calulcated similarly. - float rSum = xyz.get(0, 0) + xyz.get(0, 1) + xyz.get(0, 2); - float gSum = xyz.get(1, 0) + xyz.get(1, 1) + xyz.get(1, 2); - float bSum = xyz.get(2, 0) + xyz.get(2, 1) + xyz.get(2, 2); + float rSum = xyz.get(0, 0) + xyz.get(1, 0) + xyz.get(2, 0); + float gSum = xyz.get(0, 1) + xyz.get(1, 1) + xyz.get(2, 1); + float bSum = xyz.get(0, 2) + xyz.get(1, 2) + xyz.get(2, 2); rgb[0].fX = xyz.get(0, 0) / rSum; - rgb[0].fY = xyz.get(0, 1) / rSum; - rgb[1].fX = xyz.get(1, 0) / gSum; + rgb[0].fY = xyz.get(1, 0) / rSum; + rgb[1].fX = xyz.get(0, 1) / gSum; rgb[1].fY = xyz.get(1, 1) / gSum; - rgb[2].fX = xyz.get(2, 0) / bSum; - rgb[2].fY = xyz.get(2, 1) / bSum; + rgb[2].fX = xyz.get(0, 2) / bSum; + rgb[2].fY = xyz.get(1, 2) / bSum; } /** @@ -57,10 +57,10 @@ static void draw_gamut(SkCanvas* canvas, const SkMatrix44& xyz, const char* name bool label) { // Report the XYZ values. SkDebugf("%s\n", name); - SkDebugf(" X Y Z\n"); - SkDebugf("Red %.3f %.3f %.3f\n", xyz.get(0, 0), xyz.get(0, 1), xyz.get(0, 2)); - SkDebugf("Green %.3f %.3f %.3f\n", xyz.get(1, 0), xyz.get(1, 1), xyz.get(1, 2)); - SkDebugf("Blue %.3f %.3f %.3f\n", xyz.get(2, 0), xyz.get(2, 1), xyz.get(2, 2)); + SkDebugf(" R G B\n"); + SkDebugf("X %.3f %.3f %.3f\n", xyz.get(0, 0), xyz.get(0, 1), xyz.get(0, 2)); + SkDebugf("Y %.3f %.3f %.3f\n", xyz.get(1, 0), xyz.get(1, 1), xyz.get(1, 2)); + SkDebugf("Z %.3f %.3f %.3f\n", xyz.get(2, 0), xyz.get(2, 1), xyz.get(2, 2)); // Calculate the points in the gamut from the XYZ values. SkPoint rgb[4]; |