Don't use uninitialized gamma data for adjusting SDF distance.

If the gamma is linear, the corresponding LUT for adjusting colors
is not initialized. This change takes that into account when computing
distance adjustments for SDF text.

Change-Id: I7ca1410bb27cf29ef08ccd666297bf5c3cd3dcdd
Reviewed-on: https://skia-review.googlesource.com/38940
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/text/GrDistanceFieldAdjustTable.cpp b/src/gpu/text/GrDistanceFieldAdjustTable.cpp
index 3aa96b5..dccf010 100644
--- a/src/gpu/text/GrDistanceFieldAdjustTable.cpp
+++ b/src/gpu/text/GrDistanceFieldAdjustTable.cpp
@@ -63,7 +63,13 @@
     SkScalar* table = new SkScalar[height];
 
     SkAutoTArray<uint8_t> data((int)size);
-    SkScalerContext::GetGammaLUTData(contrast, paintGamma, deviceGamma, data.get());
+    if (!SkScalerContext::GetGammaLUTData(contrast, paintGamma, deviceGamma, data.get())) {
+        // if no valid data is available simply do no adjustment
+        for (int row = 0; row < height; ++row) {
+            table[row] = 0;
+        }
+        return table;
+    }
 
     // find the inverse points where we cross 0.5
     // binsearch might be better, but we only need to do this once on creation