| 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 "SkColorSpace_Base.h" | 8 #include "SkColorSpace_Base.h" |
| 9 #include "SkCommonFlagsConfig.h" | 9 #include "SkCommonFlagsConfig.h" |
| 10 #include "SkImageInfo.h" | 10 #include "SkImageInfo.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 , fUseDIText(useDIText) | 178 , fUseDIText(useDIText) |
| 179 , fSamples(samples) | 179 , fSamples(samples) |
| 180 , fColorType(colorType) | 180 , fColorType(colorType) |
| 181 , fColorSpace(std::move(colorSpace)) { | 181 , fColorSpace(std::move(colorSpace)) { |
| 182 if (useNVPR) { | 182 if (useNVPR) { |
| 183 fContextOptions |= ContextOptions::kEnableNVPR; | 183 fContextOptions |= ContextOptions::kEnableNVPR; |
| 184 } | 184 } |
| 185 if (useInstanced) { | 185 if (useInstanced) { |
| 186 fContextOptions |= ContextOptions::kUseInstanced; | 186 fContextOptions |= ContextOptions::kUseInstanced; |
| 187 } | 187 } |
| 188 // Subtle logic: If the config has a color space attached, we're going to be
rendering to sRGB, | |
| 189 // so we need that capability. In addition, to get the widest test coverage,
we DO NOT require | |
| 190 // that we can disable sRGB decode. (That's for rendering sRGB sources to le
gacy surfaces). | |
| 191 // | |
| 192 // If the config doesn't have a color space attached, we're going to be rend
ering in legacy | |
| 193 // mode. In that case, we can't allow a context to be created that has sRGB
support without | |
| 194 // the ability to disable sRGB decode. Otherwise, all of our sRGB source res
ources will be | |
| 195 // treated as sRGB textures, but we will be unable to prevent the decode, ca
using them to be | |
| 196 // too dark. | |
| 197 if (fColorSpace) { | 188 if (fColorSpace) { |
| 198 fContextOptions |= ContextOptions::kRequireSRGBSupport; | 189 fContextOptions |= ContextOptions::kRequireSRGBSupport; |
| 199 } else { | |
| 200 fContextOptions |= ContextOptions::kRequireSRGBDecodeDisableSupport; | |
| 201 } | 190 } |
| 202 } | 191 } |
| 203 static bool parse_option_int(const SkString& value, int* outInt) { | 192 static bool parse_option_int(const SkString& value, int* outInt) { |
| 204 if (value.isEmpty()) { | 193 if (value.isEmpty()) { |
| 205 return false; | 194 return false; |
| 206 } | 195 } |
| 207 char* endptr = nullptr; | 196 char* endptr = nullptr; |
| 208 long intValue = strtol(value.c_str(), &endptr, 10); | 197 long intValue = strtol(value.c_str(), &endptr, 10); |
| 209 if (*endptr != '\0') { | 198 if (*endptr != '\0') { |
| 210 return false; | 199 return false; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 if (extendedBackend.equals("gpu")) { | 440 if (extendedBackend.equals("gpu")) { |
| 452 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); | 441 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); |
| 453 } | 442 } |
| 454 #endif | 443 #endif |
| 455 if (!parsedConfig) { | 444 if (!parsedConfig) { |
| 456 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); | 445 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); |
| 457 } | 446 } |
| 458 outResult->emplace_back(parsedConfig); | 447 outResult->emplace_back(parsedConfig); |
| 459 } | 448 } |
| 460 } | 449 } |
| OLD | NEW |