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

Side by Side Diff: tools/flags/SkCommonFlagsConfig.cpp

Issue 2378713002: Make GPU configs use kRGBA color type not kN32. (Closed)
Patch Set: fix parsing test 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 | « tests/TestConfigParsing.cpp ('k') | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 "SkCommonFlagsConfig.h" 8 #include "SkCommonFlagsConfig.h"
9 #include "SkImageInfo.h" 9 #include "SkImageInfo.h"
10 10
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 *outContextType = GrContextFactory::kVulkan_ContextType; 260 *outContextType = GrContextFactory::kVulkan_ContextType;
261 return true; 261 return true;
262 } 262 }
263 #endif 263 #endif
264 return false; 264 return false;
265 } 265 }
266 static bool parse_option_gpu_color(const SkString& value, 266 static bool parse_option_gpu_color(const SkString& value,
267 SkColorType* outColorType, 267 SkColorType* outColorType,
268 sk_sp<SkColorSpace>* outColorSpace) { 268 sk_sp<SkColorSpace>* outColorSpace) {
269 if (value.equals("8888")) { 269 if (value.equals("8888")) {
270 *outColorType = kN32_SkColorType; 270 *outColorType = kRGBA_8888_SkColorType;
271 *outColorSpace = nullptr; 271 *outColorSpace = nullptr;
272 return true; 272 return true;
273 } 273 }
274 274
275 SkTArray<SkString> commands; 275 SkTArray<SkString> commands;
276 SkStrSplit(value.c_str(), "_", &commands); 276 SkStrSplit(value.c_str(), "_", &commands);
277 if (commands.count() < 1 || commands.count() > 2) { 277 if (commands.count() < 1 || commands.count() > 2) {
278 return false; 278 return false;
279 } 279 }
280 280
(...skipping 19 matching lines...) Expand all
300 } 300 }
301 } 301 }
302 302
303 // Now pick a color type 303 // Now pick a color type
304 if (commands[0].equals("f16")) { 304 if (commands[0].equals("f16")) {
305 *outColorType = kRGBA_F16_SkColorType; 305 *outColorType = kRGBA_F16_SkColorType;
306 *outColorSpace = colorSpace->makeLinearGamma(); 306 *outColorSpace = colorSpace->makeLinearGamma();
307 return true; 307 return true;
308 } 308 }
309 if (commands[0].equals("srgb")) { 309 if (commands[0].equals("srgb")) {
310 *outColorType = kN32_SkColorType; 310 *outColorType = kRGBA_8888_SkColorType;
311 *outColorSpace = colorSpace; 311 *outColorSpace = colorSpace;
312 return true; 312 return true;
313 } 313 }
314 return false; 314 return false;
315 } 315 }
316 316
317 SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString& tag, 317 SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString& tag,
318 const SkTArray<SkString>& vias, 318 const SkTArray<SkString>& vias,
319 const SkString& options) { 319 const SkString& options) {
320 // Defaults for GPU backend. 320 // Defaults for GPU backend.
321 bool seenAPI = false; 321 bool seenAPI = false;
322 SkCommandLineConfigGpu::ContextType contextType = GrContextFactory::kNativeG L_ContextType; 322 SkCommandLineConfigGpu::ContextType contextType = GrContextFactory::kNativeG L_ContextType;
323 bool seenUseNVPR = false; 323 bool seenUseNVPR = false;
324 bool useNVPR = false; 324 bool useNVPR = false;
325 bool seenUseInstanced = false; 325 bool seenUseInstanced = false;
326 bool useInstanced = false; 326 bool useInstanced = false;
327 bool seenUseDIText =false; 327 bool seenUseDIText =false;
328 bool useDIText = false; 328 bool useDIText = false;
329 bool seenSamples = false; 329 bool seenSamples = false;
330 int samples = 0; 330 int samples = 0;
331 bool seenColor = false; 331 bool seenColor = false;
332 SkColorType colorType = kN32_SkColorType; 332 SkColorType colorType = kRGBA_8888_SkColorType;
333 sk_sp<SkColorSpace> colorSpace = nullptr; 333 sk_sp<SkColorSpace> colorSpace = nullptr;
334 334
335 SkTArray<SkString> optionParts; 335 SkTArray<SkString> optionParts;
336 SkStrSplit(options.c_str(), ",", kStrict_SkStrSplitMode, &optionParts); 336 SkStrSplit(options.c_str(), ",", kStrict_SkStrSplitMode, &optionParts);
337 for (int i = 0; i < optionParts.count(); ++i) { 337 for (int i = 0; i < optionParts.count(); ++i) {
338 SkTArray<SkString> keyValueParts; 338 SkTArray<SkString> keyValueParts;
339 SkStrSplit(optionParts[i].c_str(), "=", kStrict_SkStrSplitMode, &keyValu eParts); 339 SkStrSplit(optionParts[i].c_str(), "=", kStrict_SkStrSplitMode, &keyValu eParts);
340 if (keyValueParts.count() != 2) { 340 if (keyValueParts.count() != 2) {
341 return nullptr; 341 return nullptr;
342 } 342 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 if (extendedBackend.equals("gpu")) { 426 if (extendedBackend.equals("gpu")) {
427 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti ons); 427 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti ons);
428 } 428 }
429 #endif 429 #endif
430 if (!parsedConfig) { 430 if (!parsedConfig) {
431 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); 431 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias);
432 } 432 }
433 outResult->emplace_back(parsedConfig); 433 outResult->emplace_back(parsedConfig);
434 } 434 }
435 } 435 }
OLDNEW
« no previous file with comments | « tests/TestConfigParsing.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698