Make the distanceFieldAdjustTable a static singleton

There is little reason for the Text Ops to be carrying around a pointer to this.

Additionally, this removes creation and initialization of this table from the DDL recording text contexts.

Bug: 1056730
Change-Id: Ie28ec479c35e4d4412954aa4c0104c4eed6fca3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279837
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index 2793f79..8338e05 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -21,6 +21,7 @@
 #include "src/gpu/effects/GrDistanceFieldGeoProc.h"
 #include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
 #include "src/gpu/text/GrAtlasManager.h"
+#include "src/gpu/text/GrDistanceFieldAdjustTable.h"
 #include "src/gpu/text/GrStrikeCache.h"
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -56,7 +57,6 @@
                                             GrRecordingContext* context,
                                             GrPaint&& paint,
                                             int glyphCount,
-                                            const GrDistanceFieldAdjustTable* distanceAdjustTable,
                                             bool useGammaCorrectDistanceTable,
                                             SkColor luminanceColor,
                                             const SkSurfaceProps& props,
@@ -72,7 +72,6 @@
                                        : isLCD ? (isBGR ? kLCDBGRDistanceField_MaskType
                                                         : kLCDDistanceField_MaskType)
                                                : kGrayscaleDistanceField_MaskType;
-        op->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable));
         op->fUseGammaCorrectDistanceTable = useGammaCorrectDistanceTable;
         op->fLuminanceColor = luminanceColor;
         op->fNumGlyphs = glyphCount;
@@ -607,15 +606,17 @@
         (void)result;
     }
 
+    auto dfAdjustTable = GrDistanceFieldAdjustTable::Get();
+
     // see if we need to create a new effect
     if (isLCD) {
-        float redCorrection = fDistanceAdjustTable->getAdjustment(
+        float redCorrection = dfAdjustTable->getAdjustment(
                 SkColorGetR(fLuminanceColor) >> kDistanceAdjustLumShift,
                 fUseGammaCorrectDistanceTable);
-        float greenCorrection = fDistanceAdjustTable->getAdjustment(
+        float greenCorrection = dfAdjustTable->getAdjustment(
                 SkColorGetG(fLuminanceColor) >> kDistanceAdjustLumShift,
                 fUseGammaCorrectDistanceTable);
-        float blueCorrection = fDistanceAdjustTable->getAdjustment(
+        float blueCorrection = dfAdjustTable->getAdjustment(
                 SkColorGetB(fLuminanceColor) >> kDistanceAdjustLumShift,
                 fUseGammaCorrectDistanceTable);
         GrDistanceFieldLCDTextGeoProc::DistanceAdjust widthAdjust =
@@ -630,8 +631,8 @@
         if (kAliasedDistanceField_MaskType != fMaskType) {
             U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONENT,
                                                                 fLuminanceColor);
-            correction = fDistanceAdjustTable->getAdjustment(lum >> kDistanceAdjustLumShift,
-                                                             fUseGammaCorrectDistanceTable);
+            correction = dfAdjustTable->getAdjustment(lum >> kDistanceAdjustLumShift,
+                                                      fUseGammaCorrectDistanceTable);
         }
         return GrDistanceFieldA8TextGeoProc::Make(arena, caps, views, numActiveViews,
                                                   GrSamplerState::Filter::kBilerp, correction,