diff options
author | Matt Sarett <msarett@google.com> | 2017-03-02 08:53:46 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-02 14:28:29 +0000 |
commit | d222830941afae55a687f784480c080f364a8377 (patch) | |
tree | 460fcba04721222494bd0ac55ab47572ca46acef /tools/flags/SkCommonFlagsConfig.cpp | |
parent | 39b101b13da171a0ba08ae7196d1a88bc8375ef7 (diff) |
Test sRGB with non-linear blending using new "srgbnl" sink
BUG=skia:
Change-Id: Ief7516c1505f8e447f83121ed4ba75b9fa9ba75b
Reviewed-on: https://skia-review.googlesource.com/8976
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tools/flags/SkCommonFlagsConfig.cpp')
-rw-r--r-- | tools/flags/SkCommonFlagsConfig.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tools/flags/SkCommonFlagsConfig.cpp b/tools/flags/SkCommonFlagsConfig.cpp index 3e5e9b9fff..c9ac767bdd 100644 --- a/tools/flags/SkCommonFlagsConfig.cpp +++ b/tools/flags/SkCommonFlagsConfig.cpp @@ -49,6 +49,7 @@ static const struct { { "esinstdit4", "gpu", "api=gles,inst=true,samples=4,dit=true" }, { "gpuf16", "gpu", "color=f16" }, { "gpusrgb", "gpu", "color=srgb" }, + { "gpusrgbnl", "gpu", "color=srgbnl" }, { "glsrgb", "gpu", "api=gl,color=srgb" }, { "glwide", "gpu", "api=gl,color=f16_wide" }, { "glnarrow", "gpu", "api=gl,color=f16_narrow" }, @@ -290,10 +291,16 @@ static bool parse_option_gpu_color(const SkString& value, return false; } - // First, figure out color gamut that we'll work in (default to sRGB) const bool linearGamma = commands[0].equals("f16"); - *outColorSpace = linearGamma ? SkColorSpace::MakeSRGBLinear() - : SkColorSpace::MakeSRGB(); + const bool nonLinearBlending = commands[0].equals("srgbnl"); + SkColorSpace::Gamut gamut = SkColorSpace::kSRGB_Gamut; + SkColorSpace::RenderTargetGamma gamma = linearGamma ? SkColorSpace::kLinear_RenderTargetGamma + : SkColorSpace::kSRGB_RenderTargetGamma; + SkColorSpace::ColorSpaceFlags flags = + nonLinearBlending ? SkColorSpace::kNonLinearBlending_ColorSpaceFlag + : (SkColorSpace::ColorSpaceFlags) 0; + *outColorSpace = SkColorSpace::MakeRGB(gamma, gamut, flags); + if (commands.count() == 2) { if (commands[1].equals("srgb")) { // sRGB gamut (which is our default) @@ -306,10 +313,7 @@ static bool parse_option_gpu_color(const SkString& value, }; SkMatrix44 wideGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor); wideGamutRGBMatrix.set3x3RowMajorf(gWideGamutRGB_toXYZD50); - *outColorSpace = SkColorSpace::MakeRGB(linearGamma - ? SkColorSpace::kLinear_RenderTargetGamma - : SkColorSpace::kSRGB_RenderTargetGamma, - wideGamutRGBMatrix); + *outColorSpace = SkColorSpace::MakeRGB(gamma, wideGamutRGBMatrix, flags); } else if (commands[1].equals("narrow")) { // NarrowGamut RGB (an artifically smaller than sRGB gamut) SkColorSpacePrimaries primaries ={ @@ -320,10 +324,7 @@ static bool parse_option_gpu_color(const SkString& value, }; SkMatrix44 narrowGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor); primaries.toXYZD50(&narrowGamutRGBMatrix); - *outColorSpace = SkColorSpace::MakeRGB(linearGamma - ? SkColorSpace::kLinear_RenderTargetGamma - : SkColorSpace::kSRGB_RenderTargetGamma, - narrowGamutRGBMatrix); + *outColorSpace = SkColorSpace::MakeRGB(gamma, narrowGamutRGBMatrix, flags); } else { // Unknown color gamut return false; @@ -335,7 +336,7 @@ static bool parse_option_gpu_color(const SkString& value, *outColorType = kRGBA_F16_SkColorType; return true; } - if (commands[0].equals("srgb")) { + if (commands[0].equals("srgb") || commands[0].equals("srgbnl")) { *outColorType = kRGBA_8888_SkColorType; return true; } |