| 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. |
| 188 if (fColorSpace) { | 197 if (fColorSpace) { |
| 189 fContextOptions |= ContextOptions::kRequireSRGBSupport; | 198 fContextOptions |= ContextOptions::kRequireSRGBSupport; |
| 199 } else { |
| 200 fContextOptions |= ContextOptions::kRequireSRGBDecodeDisableSupport; |
| 190 } | 201 } |
| 191 } | 202 } |
| 192 static bool parse_option_int(const SkString& value, int* outInt) { | 203 static bool parse_option_int(const SkString& value, int* outInt) { |
| 193 if (value.isEmpty()) { | 204 if (value.isEmpty()) { |
| 194 return false; | 205 return false; |
| 195 } | 206 } |
| 196 char* endptr = nullptr; | 207 char* endptr = nullptr; |
| 197 long intValue = strtol(value.c_str(), &endptr, 10); | 208 long intValue = strtol(value.c_str(), &endptr, 10); |
| 198 if (*endptr != '\0') { | 209 if (*endptr != '\0') { |
| 199 return false; | 210 return false; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 if (extendedBackend.equals("gpu")) { | 451 if (extendedBackend.equals("gpu")) { |
| 441 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); | 452 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOpti
ons); |
| 442 } | 453 } |
| 443 #endif | 454 #endif |
| 444 if (!parsedConfig) { | 455 if (!parsedConfig) { |
| 445 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); | 456 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias); |
| 446 } | 457 } |
| 447 outResult->emplace_back(parsedConfig); | 458 outResult->emplace_back(parsedConfig); |
| 448 } | 459 } |
| 449 } | 460 } |
| OLD | NEW |