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

Side by Side Diff: gm/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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "SkSurface.h" 10 #include "SkSurface.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return "Vertices"; 99 return "Vertices";
100 } 100 }
101 protected: 101 protected:
102 SkColor fColors[4]; 102 SkColor fColors[4];
103 }; 103 };
104 104
105 static void draw_gamut_grid(SkCanvas* canvas, SkTArray<SkAutoTDelete<CellRendere r>>& renderers) { 105 static void draw_gamut_grid(SkCanvas* canvas, SkTArray<SkAutoTDelete<CellRendere r>>& renderers) {
106 // We want our colors in our wide gamut to be obviously visibly distorted fr om sRGB, so we use 106 // We want our colors in our wide gamut to be obviously visibly distorted fr om sRGB, so we use
107 // Wide Gamut RGB (with sRGB gamma, for HW acceleration) as the working spac e for this test: 107 // Wide Gamut RGB (with sRGB gamma, for HW acceleration) as the working spac e for this test:
108 const float gWideGamutRGB_toXYZD50[]{ 108 const float gWideGamutRGB_toXYZD50[]{
109 0.7161046f, 0.2581874f, 0.0000000f, // * R 109 0.7161046f, 0.1009296f, 0.1471858f, // -> X
110 0.1009296f, 0.7249378f, 0.0517813f, // * G 110 0.2581874f, 0.7249378f, 0.0168748f, // -> Y
111 0.1471858f, 0.0168748f, 0.7734287f, // * B 111 0.0000000f, 0.0517813f, 0.7734287f, // -> Z
112 }; 112 };
113 113
114 SkMatrix44 wideGamutRGB_toXYZD50(SkMatrix44::kUninitialized_Constructor); 114 SkMatrix44 wideGamutRGB_toXYZD50(SkMatrix44::kUninitialized_Constructor);
115 wideGamutRGB_toXYZD50.set3x3RowMajorf(gWideGamutRGB_toXYZD50); 115 wideGamutRGB_toXYZD50.set3x3RowMajorf(gWideGamutRGB_toXYZD50);
116 116
117 // Use the original canvas' color type, but account for gamma requirements 117 // Use the original canvas' color type, but account for gamma requirements
118 SkImageInfo origInfo = canvas->imageInfo(); 118 SkImageInfo origInfo = canvas->imageInfo();
119 auto srgbCS = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); 119 auto srgbCS = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
120 auto wideCS = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderTargetGamma, 120 auto wideCS = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderTargetGamma,
121 wideGamutRGB_toXYZD50); 121 wideGamutRGB_toXYZD50);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 renderers.push_back(new GradientCellRenderer(SK_ColorRED, SK_ColorGREEN)); 201 renderers.push_back(new GradientCellRenderer(SK_ColorRED, SK_ColorGREEN));
202 renderers.push_back(new GradientCellRenderer(SK_ColorGREEN, SK_ColorBLACK)); 202 renderers.push_back(new GradientCellRenderer(SK_ColorGREEN, SK_ColorBLACK));
203 renderers.push_back(new GradientCellRenderer(SK_ColorGREEN, SK_ColorWHITE)); 203 renderers.push_back(new GradientCellRenderer(SK_ColorGREEN, SK_ColorWHITE));
204 204
205 // Vertex colors 205 // Vertex colors
206 renderers.push_back(new VerticesCellRenderer(SK_ColorRED, SK_ColorRED)); 206 renderers.push_back(new VerticesCellRenderer(SK_ColorRED, SK_ColorRED));
207 renderers.push_back(new VerticesCellRenderer(SK_ColorRED, SK_ColorGREEN)); 207 renderers.push_back(new VerticesCellRenderer(SK_ColorRED, SK_ColorGREEN));
208 208
209 draw_gamut_grid(canvas, renderers); 209 draw_gamut_grid(canvas, renderers);
210 } 210 }
OLDNEW
« no previous file with comments | « gm/color4f.cpp ('k') | include/core/SkMatrix44.h » ('j') | src/core/SkColorSpaceXform.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698