Remove unecessary GetGlyphIdMetrics call

BUG=skia:

Review URL: https://codereview.chromium.org/1467133003
diff --git a/src/gpu/GrBatchFontCache.cpp b/src/gpu/GrBatchFontCache.cpp
index f3844ce..ad76e4d 100644
--- a/src/gpu/GrBatchFontCache.cpp
+++ b/src/gpu/GrBatchFontCache.cpp
@@ -196,8 +196,9 @@
     }
 }
 
-bool GrBatchTextStrike::addGlyphToAtlas(GrDrawBatch::Target* target, GrGlyph* glyph,
-                                        GrFontScaler* scaler, const SkGlyph& skGlyph,
+bool GrBatchTextStrike::addGlyphToAtlas(GrDrawBatch::Target* target,
+                                        GrGlyph* glyph,
+                                        GrFontScaler* scaler,
                                         GrMaskFormat expectedMaskFormat) {
     SkASSERT(glyph);
     SkASSERT(scaler);
@@ -210,6 +211,7 @@
     size_t size = glyph->fBounds.area() * bytesPerPixel;
     SkAutoSMalloc<1024> storage(size);
 
+    const SkGlyph& skGlyph = scaler->grToSkGlyph(glyph->fPackedID);
     if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(glyph->fPackedID)) {
         if (!scaler->getPackedGlyphDFImage(skGlyph, glyph->width(), glyph->height(),
                                            storage.get())) {
diff --git a/src/gpu/GrBatchFontCache.h b/src/gpu/GrBatchFontCache.h
index 9463566..46ab1c8 100644
--- a/src/gpu/GrBatchFontCache.h
+++ b/src/gpu/GrBatchFontCache.h
@@ -43,10 +43,15 @@
     // that the maskformat of the glyph differs from what we expect.  In these cases we will just
     // draw a clear square.
     // skbug:4143 crbug:510931
-    inline GrGlyph* getGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed,
-                             GrMaskFormat expectedMaskFormat, GrFontScaler* scaler) {
+    inline GrGlyph* getGlyph(GrGlyph::PackedID packed,
+                             GrMaskFormat expectedMaskFormat,
+                             GrFontScaler* scaler) {
         GrGlyph* glyph = fCache.find(packed);
         if (nullptr == glyph) {
+            // We could return this to the caller, but in practice it adds code complexity for
+            // potentially little benefit(ie, if the glyph is not in our font cache, then its not
+            // in the atlas and we're going to be doing a texture upload anyways).
+            const SkGlyph& skGlyph = scaler->grToSkGlyph(packed);
             glyph = this->generateGlyph(skGlyph, packed, scaler);
             glyph->fMaskFormat = expectedMaskFormat;
         }
@@ -58,7 +63,7 @@
     // happen.
     // TODO we can handle some of these cases if we really want to, but the long term solution is to
     // get the actual glyph image itself when we get the glyph metrics.
-    bool addGlyphToAtlas(GrDrawBatch::Target*, GrGlyph*, GrFontScaler*, const SkGlyph&,
+    bool addGlyphToAtlas(GrDrawBatch::Target*, GrGlyph*, GrFontScaler*,
                          GrMaskFormat expectedMaskFormat);
 
     // testing
diff --git a/src/gpu/batches/GrAtlasTextBatch.cpp b/src/gpu/batches/GrAtlasTextBatch.cpp
index 9d408f9..710b155 100644
--- a/src/gpu/batches/GrAtlasTextBatch.cpp
+++ b/src/gpu/batches/GrAtlasTextBatch.cpp
@@ -168,24 +168,18 @@
         if (regenTexCoords) {
             size_t glyphOffset = glyphIdx + info->fGlyphStartIndex;
 
-            glyph = blob->fGlyphs[glyphOffset];
-            GrGlyph::PackedID id = glyph->fPackedID;
-            const SkGlyph& skGlyph = (*scaler)->grToSkGlyph(id);
             if (regenGlyphs) {
                 // Get the id from the old glyph, and use the new strike to lookup
                 // the glyph.
-                blob->fGlyphs[glyphOffset] = strike->getGlyph(skGlyph, id, this->maskFormat(),
-                                                              *scaler);
+                GrGlyph::PackedID id = blob->fGlyphs[glyphOffset]->fPackedID;
+                blob->fGlyphs[glyphOffset] = strike->getGlyph(id, this->maskFormat(), *scaler);
+                SkASSERT(id == blob->fGlyphs[glyphOffset]->fPackedID);
             }
             glyph = blob->fGlyphs[glyphOffset];
-            SkASSERT(glyph);
-            SkASSERT(id == glyph->fPackedID);
-            // We want to be able to assert this but cannot for testing purposes.
-            // once skbug:4143 has landed we can revist this assert
-            //SkASSERT(glyph->fMaskFormat == this->maskFormat());
+            SkASSERT(glyph && glyph->fMaskFormat == this->maskFormat());
 
             if (!fFontCache->hasGlyph(glyph) &&
-                !strike->addGlyphToAtlas(target, glyph, *scaler, skGlyph, this->maskFormat())) {
+                !strike->addGlyphToAtlas(target, glyph, *scaler, this->maskFormat())) {
                 this->flush(target, flushInfo);
                 target->initDraw(gp, this->pipeline());
                 brokenRun = glyphIdx > 0;
@@ -193,7 +187,6 @@
                 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas(target,
                                                                     glyph,
                                                                     *scaler,
-                                                                    skGlyph,
                                                                     this->maskFormat());
                 SkASSERT(success);
             }