Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: tools/visualize_color_gamut.cpp

Issue 2324843003: Fix storage of gamut transform matrices in SkColorSpace (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/core/SkColorSpaceXform.cpp ('K') | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/visualize_color_gamut.cpp
diff --git a/tools/visualize_color_gamut.cpp b/tools/visualize_color_gamut.cpp
index a0b8b82c6516fb6cfbb773d28057122b99ffc79d..cc15601b7d83286b08a0e4b35fe067ed5b333d14 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];
« src/core/SkColorSpaceXform.cpp ('K') | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698