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

Unified Diff: tools/flags/SkCommonFlagsConfig.cpp

Issue 2389983002: Refactored SkColorSpace and added in a Lab PCS GM (Closed)
Patch Set: migrated call from SkColorSpace_Base::makeLinearGamma() to SkColorSpace_XYZ::makeLinearGamma() 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/TestConfigParsing.cpp ('k') | tools/visualize_color_gamut.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/flags/SkCommonFlagsConfig.cpp
diff --git a/tools/flags/SkCommonFlagsConfig.cpp b/tools/flags/SkCommonFlagsConfig.cpp
index 20dc26600abf64e3886bccedd9820b77bf4457a5..ac3559c1aa19114d4e3326c61eb08872a3088d25 100644
--- a/tools/flags/SkCommonFlagsConfig.cpp
+++ b/tools/flags/SkCommonFlagsConfig.cpp
@@ -133,7 +133,6 @@ static const char configExtendedHelp[] =
"\t Options:\n"
"\t\tsrgb\t\t\tsRGB gamut.\n"
"\t\twide\t\t\tWide Gamut RGB.\n"
- "\t\tnarrow\t\t\tNarrow Gamut RGB.\n"
"\tdit\ttype: bool\tdefault: false.\n"
"\t Use device independent text.\n"
"\tnvpr\ttype: bool\tdefault: false.\n"
@@ -283,7 +282,9 @@ static bool parse_option_gpu_color(const SkString& value,
}
// First, figure out color gamut that we'll work in (default to sRGB)
- sk_sp<SkColorSpace> colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
+ const bool linearGamma = commands[0].equals("f16");
+ *outColorSpace = SkColorSpace::NewNamed(linearGamma ? SkColorSpace::kSRGBLinear_Named
+ : SkColorSpace::kSRGB_Named);
if (commands.count() == 2) {
if (commands[1].equals("srgb")) {
// sRGB gamut (which is our default)
@@ -296,8 +297,10 @@ static bool parse_option_gpu_color(const SkString& value,
};
SkMatrix44 wideGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor);
wideGamutRGBMatrix.set3x3RowMajorf(gWideGamutRGB_toXYZD50);
- colorSpace = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderTargetGamma,
- wideGamutRGBMatrix);
+ *outColorSpace = SkColorSpace::NewRGB(linearGamma
+ ? SkColorSpace::kLinear_RenderTargetGamma
+ : SkColorSpace::kSRGB_RenderTargetGamma,
+ wideGamutRGBMatrix);
} else if (commands[1].equals("narrow")) {
// NarrowGamut RGB (an artifically smaller than sRGB gamut)
SkColorSpacePrimaries primaries ={
@@ -308,8 +311,10 @@ static bool parse_option_gpu_color(const SkString& value,
};
SkMatrix44 narrowGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor);
primaries.toXYZD50(&narrowGamutRGBMatrix);
- colorSpace = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderTargetGamma,
- narrowGamutRGBMatrix);
+ *outColorSpace = SkColorSpace::NewRGB(linearGamma
+ ? SkColorSpace::kLinear_RenderTargetGamma
+ : SkColorSpace::kSRGB_RenderTargetGamma,
+ narrowGamutRGBMatrix);
} else {
// Unknown color gamut
return false;
@@ -319,12 +324,10 @@ static bool parse_option_gpu_color(const SkString& value,
// Now pick a color type
if (commands[0].equals("f16")) {
*outColorType = kRGBA_F16_SkColorType;
- *outColorSpace = as_CSB(colorSpace)->makeLinearGamma();
return true;
}
if (commands[0].equals("srgb")) {
*outColorType = kRGBA_8888_SkColorType;
- *outColorSpace = colorSpace;
return true;
}
return false;
« no previous file with comments | « tests/TestConfigParsing.cpp ('k') | tools/visualize_color_gamut.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698