Revert of Break LCD and Bitmap text dependency on hardcoded atlas values (patchset #2 id:20001 of https://codereview.chromium.org/1271873002/ )

Reason for revert:
Breaks S3

Original issue's description:
> Break LCD and Bitmap text dependency on hardcoded atlas values
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/846b022f6b469cfde285372f26e0d5c593d122ac

TBR=jvanverth@google.com,bsalomon@google.com,joshualitt@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1271163003
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 9496dbf..a0350e9 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -28,19 +28,18 @@
         // emit attributes
         vsBuilder->emitAttributes(cte);
 
-        // compute numbers to be hardcoded to convert texture coordinates from int to float
-        SkASSERT(cte.numTextures() == 1);
-        GrTexture* atlas = cte.textureAccess(0).getTexture();
-        SkASSERT(atlas);
-        SkScalar recipWidth = 1.0f / atlas->width();
-        SkScalar recipHeight = 1.0f / atlas->height();
-
         GrGLVertToFrag v(kVec2f_GrSLType);
         pb->addVarying("TextureCoords", &v);
-        vsBuilder->codeAppendf("%s = vec2(%.*f, %.*f) * %s;", v.vsOut(),
-                               SK_FLT_DECIMAL_DIG, recipWidth,
-                               SK_FLT_DECIMAL_DIG, recipHeight,
-                               cte.inTextureCoords()->fName);
+        // this is only used with text, so our texture bounds always match the glyph atlas
+        if (cte.maskFormat() == kA8_GrMaskFormat) {
+            vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_A8_RECIP_WIDTH ", "
+                                   GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", v.vsOut(),
+                                   cte.inTextureCoords()->fName);
+        } else {
+            vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_RECIP_WIDTH ", "
+                                   GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", v.vsOut(),
+                                   cte.inTextureCoords()->fName);
+        }
 
         // Setup pass through color
         if (!cte.colorIgnored()) {
@@ -103,13 +102,6 @@
         key |= gp.colorIgnored() ? 0x2 : 0x0;
         key |= gp.maskFormat() << 3;
         b->add32(key);
-
-        // Currently we hardcode numbers to convert atlas coordinates to normalized floating point
-        SkASSERT(gp.numTextures() == 1);
-        GrTexture* atlas = gp.textureAccess(0).getTexture();
-        SkASSERT(atlas);
-        b->add32(atlas->width());
-        b->add32(atlas->height());
     }
 
 private:
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 0b97bb2..8af5631 100755
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -77,18 +77,11 @@
         args.fPB->addVarying("IntTextureCoords", &st, kHigh_GrSLPrecision);
         vsBuilder->codeAppendf("%s = %s;", st.vsOut(), dfTexEffect.inTextureCoords()->fName);
 
-        // compute numbers to be hardcoded to convert texture coordinates from int to float
-        SkASSERT(dfTexEffect.numTextures() == 1);
-        GrTexture* atlas = dfTexEffect.textureAccess(0).getTexture();
-        SkASSERT(atlas);
-        SkScalar recipWidth = 1.0f / atlas->width();
-        SkScalar recipHeight = 1.0f / atlas->height();
-
         GrGLVertToFrag uv(kVec2f_GrSLType);
         args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision);
-        vsBuilder->codeAppendf("%s = vec2(%.*f, %.*f) * %s;", uv.vsOut(),
-                               SK_FLT_DECIMAL_DIG, recipWidth,
-                               SK_FLT_DECIMAL_DIG, recipHeight,
+        // this is only used with text, so our texture bounds always match the glyph atlas
+        vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_A8_RECIP_WIDTH ", "
+                               GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", uv.vsOut(),
                                dfTexEffect.inTextureCoords()->fName);
         
         // Use highp to work around aliasing issues
@@ -183,13 +176,6 @@
         key |= dfTexEffect.colorIgnored() << 17;
         key |= ComputePosKey(dfTexEffect.viewMatrix()) << 25;
         b->add32(key);
-
-        // Currently we hardcode numbers to convert atlas coordinates to normalized floating point
-        SkASSERT(gp.numTextures() == 1);
-        GrTexture* atlas = gp.textureAccess(0).getTexture();
-        SkASSERT(atlas);
-        b->add32(atlas->width());
-        b->add32(atlas->height());
     }
 
 private:
@@ -539,18 +525,11 @@
         args.fPB->addVarying("IntTextureCoords", &st, kHigh_GrSLPrecision);
         vsBuilder->codeAppendf("%s = %s;", st.vsOut(), dfTexEffect.inTextureCoords()->fName);
 
-        // compute numbers to be hardcoded to convert texture coordinates from int to float
-        SkASSERT(dfTexEffect.numTextures() == 1);
-        GrTexture* atlas = dfTexEffect.textureAccess(0).getTexture();
-        SkASSERT(atlas);
-        SkScalar recipWidth = 1.0f / atlas->width();
-        SkScalar recipHeight = 1.0f / atlas->height();
-
         GrGLVertToFrag uv(kVec2f_GrSLType);
         args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision);
-        vsBuilder->codeAppendf("%s = vec2(%.*f, %.*f) * %s;", uv.vsOut(),
-                               SK_FLT_DECIMAL_DIG, recipWidth,
-                               SK_FLT_DECIMAL_DIG, recipHeight,
+        // this is only used with text, so our texture bounds always match the glyph atlas
+        vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_A8_RECIP_WIDTH ", "
+                               GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", uv.vsOut(),
                                dfTexEffect.inTextureCoords()->fName);
 
         // add frag shader code
@@ -566,12 +545,10 @@
         fsBuilder->codeAppendf("vec2 uv = %s;\n", uv.fsIn());
         fsBuilder->codeAppend(GrGLShaderVar::PrecisionString(kHigh_GrSLPrecision,
                                                              pb->ctxInfo().standard()));
-
-        SkScalar lcdDelta = 1.0f / (3.0f * atlas->width());
         if (dfTexEffect.getFlags() & kBGR_DistanceFieldEffectFlag) {
-            fsBuilder->codeAppendf("float delta = -%.*f;\n", SK_FLT_DECIMAL_DIG, lcdDelta);
+            fsBuilder->codeAppend("float delta = -" GR_FONT_ATLAS_LCD_DELTA ";\n");
         } else {
-            fsBuilder->codeAppendf("float delta = %.*f;\n", SK_FLT_DECIMAL_DIG, lcdDelta);
+            fsBuilder->codeAppend("float delta = " GR_FONT_ATLAS_LCD_DELTA ";\n");
         }
         if (isUniformScale) {
             fsBuilder->codeAppendf("float dy = abs(dFdy(%s.y));", st.fsIn());
@@ -691,13 +668,6 @@
         key |= dfTexEffect.colorIgnored() << 16;
         key |= ComputePosKey(dfTexEffect.viewMatrix()) << 25;
         b->add32(key);
-
-        // Currently we hardcode numbers to convert atlas coordinates to normalized floating point
-        SkASSERT(gp.numTextures() == 1);
-        GrTexture* atlas = gp.textureAccess(0).getTexture();
-        SkASSERT(atlas);
-        b->add32(atlas->width());
-        b->add32(atlas->height());
     }
 
 private: