OLD | NEW |
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 " hwui" | 89 " hwui" |
90 #endif | 90 #endif |
91 ; | 91 ; |
92 | 92 |
93 static const char* config_help_fn() { | 93 static const char* config_help_fn() { |
94 static SkString helpString; | 94 static SkString helpString; |
95 helpString.set(configHelp); | 95 helpString.set(configHelp); |
96 for (const auto& config : gPredefinedConfigs) { | 96 for (const auto& config : gPredefinedConfigs) { |
97 helpString.appendf(" %s", config.predefinedConfig); | 97 helpString.appendf(" %s", config.predefinedConfig); |
98 } | 98 } |
99 helpString.append(" or use extended form 'backend(option=value,...)'.\n"); | 99 helpString.append(" or use extended form 'backend[option=value,...]'.\n"); |
100 return helpString.c_str(); | 100 return helpString.c_str(); |
101 } | 101 } |
102 | 102 |
103 static const char configExtendedHelp[] = | 103 static const char configExtendedHelp[] = |
104 "Extended form: 'backend(option=value,...)'\n\n" | 104 "Extended form: 'backend(option=value,...)'\n\n" |
105 "Possible backends and options:\n" | 105 "Possible backends and options:\n" |
106 #if SK_SUPPORT_GPU | 106 #if SK_SUPPORT_GPU |
107 "\n" | 107 "\n" |
108 "gpu(api=string,color=string,dit=bool,nvpr=bool,inst=bool,samples=int)\n" | 108 "gpu[api=string,color=string,dit=bool,nvpr=bool,inst=bool,samples=int]\n" |
109 "\tapi\ttype: string\tdefault: native.\n" | 109 "\tapi\ttype: string\tdefault: native.\n" |
110 "\t Select graphics API to use with gpu backend.\n" | 110 "\t Select graphics API to use with gpu backend.\n" |
111 "\t Options:\n" | 111 "\t Options:\n" |
112 "\t\tnative\t\t\tUse platform default OpenGL or OpenGL ES backend.\n" | 112 "\t\tnative\t\t\tUse platform default OpenGL or OpenGL ES backend.\n" |
113 "\t\tgl \t\t\tUse OpenGL.\n" | 113 "\t\tgl \t\t\tUse OpenGL.\n" |
114 "\t\tgles \t\t\tUse OpenGL ES.\n" | 114 "\t\tgles \t\t\tUse OpenGL ES.\n" |
115 "\t\tdebug \t\t\tUse debug OpenGL.\n" | 115 "\t\tdebug \t\t\tUse debug OpenGL.\n" |
116 "\t\tnull \t\t\tUse null OpenGL.\n" | 116 "\t\tnull \t\t\tUse null OpenGL.\n" |
117 #if SK_ANGLE | 117 #if SK_ANGLE |
118 #ifdef SK_BUILD_FOR_WIN | 118 #ifdef SK_BUILD_FOR_WIN |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 SkCommandLineConfigArray* outResult) { | 375 SkCommandLineConfigArray* outResult) { |
376 outResult->reset(); | 376 outResult->reset(); |
377 for (int i = 0; i < configs.count(); ++i) { | 377 for (int i = 0; i < configs.count(); ++i) { |
378 SkString extendedBackend; | 378 SkString extendedBackend; |
379 SkString extendedOptions; | 379 SkString extendedOptions; |
380 SkString simpleBackend; | 380 SkString simpleBackend; |
381 SkTArray<SkString> vias; | 381 SkTArray<SkString> vias; |
382 | 382 |
383 SkString tag(configs[i]); | 383 SkString tag(configs[i]); |
384 SkTArray<SkString> parts; | 384 SkTArray<SkString> parts; |
385 SkStrSplit(tag.c_str(), "(", kStrict_SkStrSplitMode, &parts); | 385 SkStrSplit(tag.c_str(), "[", kStrict_SkStrSplitMode, &parts); |
386 if (parts.count() == 2) { | 386 if (parts.count() == 2) { |
387 SkTArray<SkString> parts2; | 387 SkTArray<SkString> parts2; |
388 SkStrSplit(parts[1].c_str(), ")", kStrict_SkStrSplitMode, &parts2); | 388 SkStrSplit(parts[1].c_str(), "]", kStrict_SkStrSplitMode, &parts2); |
389 if (parts2.count() == 2 && parts2[1].isEmpty()) { | 389 if (parts2.count() == 2 && parts2[1].isEmpty()) { |
390 SkStrSplit(parts[0].c_str(), "-", kStrict_SkStrSplitMode, &vias)
; | 390 SkStrSplit(parts[0].c_str(), "-", kStrict_SkStrSplitMode, &vias)
; |
391 if (vias.count()) { | 391 if (vias.count()) { |
392 extendedBackend = vias[vias.count() - 1]; | 392 extendedBackend = vias[vias.count() - 1]; |
393 vias.pop_back(); | 393 vias.pop_back(); |
394 } else { | 394 } else { |
395 extendedBackend = parts[0]; | 395 extendedBackend = parts[0]; |
396 } | 396 } |
397 extendedOptions = parts2[0]; | 397 extendedOptions = parts2[0]; |
398 simpleBackend.printf("%s(%s)", extendedBackend.c_str(), extended
Options.c_str()); | 398 simpleBackend.printf("%s[%s]", extendedBackend.c_str(), extended
Options.c_str()); |
399 } | 399 } |
400 } | 400 } |
401 | 401 |
402 if (extendedBackend.isEmpty()) { | 402 if (extendedBackend.isEmpty()) { |
403 simpleBackend = tag; | 403 simpleBackend = tag; |
404 SkStrSplit(tag.c_str(), "-", kStrict_SkStrSplitMode, &vias); | 404 SkStrSplit(tag.c_str(), "-", kStrict_SkStrSplitMode, &vias); |
405 if (vias.count()) { | 405 if (vias.count()) { |
406 simpleBackend = vias[vias.count() - 1]; | 406 simpleBackend = vias[vias.count() - 1]; |
407 vias.pop_back(); | 407 vias.pop_back(); |
408 } | 408 } |
(...skipping 17 matching lines...) Expand all Loading... |
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 } |
OLD | NEW |