| 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 | 10 |
| 10 #include <stdlib.h> | 11 #include <stdlib.h> |
| 11 | 12 |
| 12 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
| 13 using sk_gpu_test::GrContextFactory; | 14 using sk_gpu_test::GrContextFactory; |
| 14 #endif | 15 #endif |
| 15 | 16 |
| 16 static const char defaultConfigs[] = | 17 static const char defaultConfigs[] = |
| 17 "565 8888 gpu nonrendering" | 18 "565 8888 gpu nonrendering" |
| 18 #if SK_ANGLE | 19 #if SK_ANGLE |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 SkCommandLineConfig::~SkCommandLineConfig() { | 202 SkCommandLineConfig::~SkCommandLineConfig() { |
| 202 } | 203 } |
| 203 | 204 |
| 204 #if SK_SUPPORT_GPU | 205 #if SK_SUPPORT_GPU |
| 205 SkCommandLineConfigGpu::SkCommandLineConfigGpu( | 206 SkCommandLineConfigGpu::SkCommandLineConfigGpu( |
| 206 const SkString& tag, const SkTArray<SkString>& viaParts, ContextType context
Type, bool useNVPR, | 207 const SkString& tag, const SkTArray<SkString>& viaParts, ContextType context
Type, bool useNVPR, |
| 207 bool useInstanced, bool useDIText, int samples, SkColorType colorType, | 208 bool useInstanced, bool useDIText, int samples, SkColorType colorType, |
| 208 sk_sp<SkColorSpace> colorSpace) | 209 sk_sp<SkColorSpace> colorSpace) |
| 209 : SkCommandLineConfig(tag, SkString("gpu"), viaParts) | 210 : SkCommandLineConfig(tag, SkString("gpu"), viaParts) |
| 210 , fContextType(contextType) | 211 , fContextType(contextType) |
| 211 , fUseNVPR(useNVPR) | 212 , fContextOptions(ContextOptions::kNone) |
| 212 , fUseInstanced(useInstanced) | |
| 213 , fUseDIText(useDIText) | 213 , fUseDIText(useDIText) |
| 214 , fSamples(samples) | 214 , fSamples(samples) |
| 215 , fColorType(colorType) | 215 , fColorType(colorType) |
| 216 , fColorSpace(std::move(colorSpace)) { | 216 , fColorSpace(std::move(colorSpace)) { |
| 217 if (useNVPR) { |
| 218 fContextOptions |= ContextOptions::kEnableNVPR; |
| 219 } |
| 220 if (useInstanced) { |
| 221 fContextOptions |= ContextOptions::kUseInstanced; |
| 222 } |
| 223 if (SkColorAndColorSpaceAreGammaCorrect(colorType, colorSpace.get())) { |
| 224 fContextOptions |= ContextOptions::kRequireSRGBSupport; |
| 225 } |
| 217 } | 226 } |
| 218 static bool parse_option_int(const SkString& value, int* outInt) { | 227 static bool parse_option_int(const SkString& value, int* outInt) { |
| 219 if (value.isEmpty()) { | 228 if (value.isEmpty()) { |
| 220 return false; | 229 return false; |
| 221 } | 230 } |
| 222 char* endptr = nullptr; | 231 char* endptr = nullptr; |
| 223 long intValue = strtol(value.c_str(), &endptr, 10); | 232 long intValue = strtol(value.c_str(), &endptr, 10); |
| 224 if (*endptr != '\0') { | 233 if (*endptr != '\0') { |
| 225 return false; | 234 return false; |
| 226 } | 235 } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 if (extendedBackend.equals("gpu")) { | 430 if (extendedBackend.equals("gpu")) { |
| 422 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); | 431 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); |
| 423 } | 432 } |
| 424 #endif | 433 #endif |
| 425 if (!parsedConfig) { | 434 if (!parsedConfig) { |
| 426 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); | 435 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); |
| 427 } | 436 } |
| 428 outResult->emplace_back(parsedConfig); | 437 outResult->emplace_back(parsedConfig); |
| 429 } | 438 } |
| 430 } | 439 } |
| OLD | NEW |