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

Side by Side Diff: gm/gamut.cpp

Issue 2380313002: Revert of Fix gamut GM to work w/serialization configs. Remove it from blacklist. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | infra/bots/recipes/swarm_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 const float gWideGamutRGB_toXYZD50[]{ 118 const float gWideGamutRGB_toXYZD50[]{
119 0.7161046f, 0.1009296f, 0.1471858f, // -> X 119 0.7161046f, 0.1009296f, 0.1471858f, // -> X
120 0.2581874f, 0.7249378f, 0.0168748f, // -> Y 120 0.2581874f, 0.7249378f, 0.0168748f, // -> Y
121 0.0000000f, 0.0517813f, 0.7734287f, // -> Z 121 0.0000000f, 0.0517813f, 0.7734287f, // -> Z
122 }; 122 };
123 123
124 SkMatrix44 wideGamutRGB_toXYZD50(SkMatrix44::kUninitialized_Constructor); 124 SkMatrix44 wideGamutRGB_toXYZD50(SkMatrix44::kUninitialized_Constructor);
125 wideGamutRGB_toXYZD50.set3x3RowMajorf(gWideGamutRGB_toXYZD50); 125 wideGamutRGB_toXYZD50.set3x3RowMajorf(gWideGamutRGB_toXYZD50);
126 126
127 // Use the original canvas' color type, but account for gamma requirements 127 // Use the original canvas' color type, but account for gamma requirements
128 SkColorType colorType = canvas->imageInfo().colorType(); 128 SkImageInfo origInfo = canvas->imageInfo();
129 if (kUnknown_SkColorType == colorType) {
130 // This can happen when recording (in which case we'll just use 8888 off screen surfaces)
131 colorType = kN32_SkColorType;
132 }
133 auto srgbCS = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); 129 auto srgbCS = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
134 auto wideCS = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderTargetGamma, 130 auto wideCS = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderTargetGamma,
135 wideGamutRGB_toXYZD50); 131 wideGamutRGB_toXYZD50);
136 switch (colorType) { 132 switch (origInfo.colorType()) {
137 case kRGBA_8888_SkColorType: 133 case kRGBA_8888_SkColorType:
138 case kBGRA_8888_SkColorType: 134 case kBGRA_8888_SkColorType:
139 break; 135 break;
140 case kRGBA_F16_SkColorType: 136 case kRGBA_F16_SkColorType:
141 srgbCS = srgbCS->makeLinearGamma(); 137 srgbCS = srgbCS->makeLinearGamma();
142 wideCS = wideCS->makeLinearGamma(); 138 wideCS = wideCS->makeLinearGamma();
143 break; 139 break;
144 default: 140 default:
145 return; 141 return;
146 } 142 }
147 143
148 // Make our two working surfaces (one sRGB, one Adobe) 144 // Make our two working surfaces (one sRGB, one Adobe)
149 SkImageInfo srgbGamutInfo = SkImageInfo::Make(gRectSize, gRectSize, colorTyp e, 145 SkImageInfo srgbGamutInfo = SkImageInfo::Make(gRectSize, gRectSize, origInfo .colorType(),
150 kPremul_SkAlphaType, srgbCS); 146 kPremul_SkAlphaType, srgbCS);
151 SkImageInfo wideGamutInfo = SkImageInfo::Make(gRectSize, gRectSize, colorTyp e, 147 SkImageInfo wideGamutInfo = SkImageInfo::Make(gRectSize, gRectSize, origInfo .colorType(),
152 kPremul_SkAlphaType, wideCS); 148 kPremul_SkAlphaType, wideCS);
153 // readPixels doesn't do color conversion (yet), so we can use it to see the raw (wide) data 149 // readPixels doesn't do color conversion (yet), so we can use it to see the raw (wide) data
154 SkImageInfo dstInfo = srgbGamutInfo.makeColorSpace(nullptr); 150 SkImageInfo dstInfo = srgbGamutInfo.makeColorSpace(nullptr);
155 sk_sp<SkSurface> srgbGamutSurface = canvas->makeSurface(srgbGamutInfo); 151 sk_sp<SkSurface> srgbGamutSurface = canvas->makeSurface(srgbGamutInfo);
156 if (!srgbGamutSurface) {
157 srgbGamutSurface = SkSurface::MakeRaster(srgbGamutInfo);
158 }
159 sk_sp<SkSurface> wideGamutSurface = canvas->makeSurface(wideGamutInfo); 152 sk_sp<SkSurface> wideGamutSurface = canvas->makeSurface(wideGamutInfo);
160 if (!wideGamutSurface) { 153 if (!srgbGamutSurface || !wideGamutSurface) {
161 wideGamutSurface = SkSurface::MakeRaster(wideGamutInfo); 154 return;
162 } 155 }
163 SkCanvas* srgbGamutCanvas = srgbGamutSurface->getCanvas(); 156 SkCanvas* srgbGamutCanvas = srgbGamutSurface->getCanvas();
164 SkCanvas* wideGamutCanvas = wideGamutSurface->getCanvas(); 157 SkCanvas* wideGamutCanvas = wideGamutSurface->getCanvas();
165 158
166 SkPaint textPaint; 159 SkPaint textPaint;
167 textPaint.setAntiAlias(true); 160 textPaint.setAntiAlias(true);
168 textPaint.setColor(SK_ColorWHITE); 161 textPaint.setColor(SK_ColorWHITE);
169 sk_tool_utils::set_portable_typeface(&textPaint); 162 sk_tool_utils::set_portable_typeface(&textPaint);
170 163
171 SkScalar x = 0, y = 0; 164 SkScalar x = 0, y = 0;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 renderers.push_back(new GradientCellRenderer(SK_ColorRED, SK_ColorGREEN, tru e)); 218 renderers.push_back(new GradientCellRenderer(SK_ColorRED, SK_ColorGREEN, tru e));
226 renderers.push_back(new GradientCellRenderer(SK_ColorGREEN, SK_ColorBLACK, t rue)); 219 renderers.push_back(new GradientCellRenderer(SK_ColorGREEN, SK_ColorBLACK, t rue));
227 renderers.push_back(new GradientCellRenderer(SK_ColorGREEN, SK_ColorWHITE, t rue)); 220 renderers.push_back(new GradientCellRenderer(SK_ColorGREEN, SK_ColorWHITE, t rue));
228 221
229 // Vertex colors 222 // Vertex colors
230 renderers.push_back(new VerticesCellRenderer(SK_ColorRED, SK_ColorRED)); 223 renderers.push_back(new VerticesCellRenderer(SK_ColorRED, SK_ColorRED));
231 renderers.push_back(new VerticesCellRenderer(SK_ColorRED, SK_ColorGREEN)); 224 renderers.push_back(new VerticesCellRenderer(SK_ColorRED, SK_ColorGREEN));
232 225
233 draw_gamut_grid(canvas, renderers); 226 draw_gamut_grid(canvas, renderers);
234 } 227 }
OLDNEW
« no previous file with comments | « no previous file | infra/bots/recipes/swarm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698