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>
diff --git a/tools/flags/SkCommonFlagsConfig.cpp b/tools/flags/SkCommonFlagsConfig.cpp
index 3e5e9b9..c9ac767 100644
--- a/tools/flags/SkCommonFlagsConfig.cpp
+++ b/tools/flags/SkCommonFlagsConfig.cpp
@@ -49,6 +49,7 @@
     { "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 @@
         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 @@
             };
             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 @@
             };
             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 @@
         *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;
     }