sRGB support for distance field text.

Add a second distance field adjust table that only applies contrast,
not fake-gamma correction. Store a flag in the batch at creation time,
using the same logic we apply elsewhere (render target format, plus
paint flags).

That gets us close, but not as good as bitmap text. The final step is
to use a linear step function (rather than smoothstep) to map distance
to coverage, when we have sRGB output. Smoothstep's nonlinear response
is actually doing some fake-gamma, so it ends up over-correcting when
the output is already gamma-correct.

Results are now very close between L32 (old table, smoothstep) and S32
(contrast-only table, linstep).

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1885613002

Review URL: https://codereview.chromium.org/1885613002
diff --git a/src/gpu/text/GrDistanceFieldAdjustTable.cpp b/src/gpu/text/GrDistanceFieldAdjustTable.cpp
index 1c5aece..c6da175 100644
--- a/src/gpu/text/GrDistanceFieldAdjustTable.cpp
+++ b/src/gpu/text/GrDistanceFieldAdjustTable.cpp
@@ -11,7 +11,7 @@
 
 SkDEBUGCODE(static const int kExpectedDistanceAdjustTableSize = 8;)
 
-void GrDistanceFieldAdjustTable::buildDistanceAdjustTable() {
+SkScalar* build_distance_adjust_table(SkScalar paintGamma, SkScalar deviceGamma) {
     // This is used for an approximation of the mask gamma hack, used by raster and bitmap
     // text. The mask gamma hack is based off of guessing what the blend color is going to
     // be, and adjusting the mask so that when run through the linear blend will
@@ -55,14 +55,12 @@
 #else
     SkScalar contrast = 0.5f;
 #endif
-    SkScalar paintGamma = SK_GAMMA_EXPONENT;
-    SkScalar deviceGamma = SK_GAMMA_EXPONENT;
 
     size = SkScalerContext::GetGammaLUTSize(contrast, paintGamma, deviceGamma,
         &width, &height);
 
     SkASSERT(kExpectedDistanceAdjustTableSize == height);
-    fTable = new SkScalar[height];
+    SkScalar* table = new SkScalar[height];
 
     SkAutoTArray<uint8_t> data((int)size);
     SkScalerContext::GetGammaLUTData(contrast, paintGamma, deviceGamma, data.get());
@@ -85,9 +83,16 @@
                 const float kDistanceFieldAAFactor = 0.65f; // should match SK_DistanceFieldAAFactor
                 float d = 2.0f*kDistanceFieldAAFactor*t - kDistanceFieldAAFactor;
 
-                fTable[row] = d;
+                table[row] = d;
                 break;
             }
         }
     }
+
+    return table;
+}
+
+void GrDistanceFieldAdjustTable::buildDistanceAdjustTables() {
+    fTable = build_distance_adjust_table(SK_GAMMA_EXPONENT, SK_GAMMA_EXPONENT);
+    fSRGBTable = build_distance_adjust_table(SK_Scalar1, SK_Scalar1);
 }