Cleaup GrTextStrike and GrStrikeCache

Make names to be more explicit...
grStrike for GrTextStrike
grStrikeCache for GrStrikeCache
skStrike for SkStrike
SkStrikeCache for SkStrikeCache

Inline some small functions to identify patterns in
usage.

Change-Id: I770f12feaf7f389a633b5a194ad0eaec1672bfaa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212503
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/src/core/SkStrike.cpp b/src/core/SkStrike.cpp
index ec35b5c..b9e753a 100644
--- a/src/core/SkStrike.cpp
+++ b/src/core/SkStrike.cpp
@@ -76,9 +76,13 @@
 }
 
 const SkGlyph& SkStrike::getGlyphIDMetrics(uint16_t glyphID, SkFixed x, SkFixed y) {
-    VALIDATE();
     SkPackedGlyphID packedGlyphID(glyphID, x, y);
-    return *this->lookupByPackedGlyphID(packedGlyphID, kFull_MetricsType);
+    return this->getGlyphIDMetrics(packedGlyphID);
+}
+
+const SkGlyph& SkStrike::getGlyphIDMetrics(SkPackedGlyphID id) {
+    VALIDATE();
+    return *this->lookupByPackedGlyphID(id, kFull_MetricsType);
 }
 
 void SkStrike::getAdvances(SkSpan<const SkGlyphID> glyphIDs, SkPoint advances[]) {
diff --git a/src/core/SkStrike.h b/src/core/SkStrike.h
index 5a1e972..c86b316 100644
--- a/src/core/SkStrike.h
+++ b/src/core/SkStrike.h
@@ -64,6 +64,8 @@
     */
     const SkGlyph& getGlyphIDMetrics(uint16_t, SkFixed x, SkFixed y);
 
+    const SkGlyph& getGlyphIDMetrics(SkPackedGlyphID id);
+
     void getAdvances(SkSpan<const SkGlyphID>, SkPoint[]);
 
     /** Returns the number of glyphs for this strike.
diff --git a/src/gpu/text/GrStrikeCache.cpp b/src/gpu/text/GrStrikeCache.cpp
index 780802f..a16c58e 100644
--- a/src/gpu/text/GrStrikeCache.cpp
+++ b/src/gpu/text/GrStrikeCache.cpp
@@ -39,17 +39,17 @@
 }
 
 void GrStrikeCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
-    GrStrikeCache* glyphCache = reinterpret_cast<GrStrikeCache*>(ptr);
+    GrStrikeCache* grStrikeCache = reinterpret_cast<GrStrikeCache*>(ptr);
 
-    StrikeHash::Iter iter(&glyphCache->fCache);
+    StrikeHash::Iter iter(&grStrikeCache->fCache);
     for (; !iter.done(); ++iter) {
         GrTextStrike* strike = &*iter;
         strike->removeID(id);
 
         // clear out any empty strikes.  We will preserve the strike whose call to addToAtlas
         // triggered the eviction
-        if (strike != glyphCache->fPreserveStrike && 0 == strike->fAtlasedGlyphs) {
-            glyphCache->fCache.remove(GrTextStrike::GetKey(*strike));
+        if (strike != grStrikeCache->fPreserveStrike && 0 == strike->fAtlasedGlyphs) {
+            grStrikeCache->fCache.remove(GrTextStrike::GetKey(*strike));
             strike->fIsAbandoned = true;
             strike->unref();
         }
@@ -172,12 +172,6 @@
 GrTextStrike::GrTextStrike(const SkDescriptor& key)
     : fFontScalerKey(key) {}
 
-GrGlyph* GrTextStrike::generateGlyph(const SkGlyph& skGlyph) {
-    GrGlyph* grGlyph = fAlloc.make<GrGlyph>(skGlyph);
-    fCache.add(grGlyph);
-    return grGlyph;
-}
-
 void GrTextStrike::removeID(GrDrawOpAtlas::AtlasID id) {
     SkTDynamicHash<GrGlyph, SkPackedGlyphID>::Iter iter(&fCache);
     while (!iter.done()) {
@@ -196,11 +190,11 @@
                                    GrStrikeCache* glyphCache,
                                    GrAtlasManager* fullAtlasManager,
                                    GrGlyph* glyph,
-                                   SkStrike* cache,
+                                   SkStrike* skStrikeCache,
                                    GrMaskFormat expectedMaskFormat,
                                    bool isScaledGlyph) {
     SkASSERT(glyph);
-    SkASSERT(cache);
+    SkASSERT(skStrikeCache);
     SkASSERT(fCache.find(glyph->fPackedID));
 
     expectedMaskFormat = fullAtlasManager->resolveMaskFormat(expectedMaskFormat);
@@ -221,13 +215,13 @@
     }
     SkAutoSMalloc<1024> storage(size);
 
-    const SkGlyph& skGlyph = GrToSkGlyph(cache, glyph->fPackedID);
+    const SkGlyph& skGlyph = skStrikeCache->getGlyphIDMetrics(glyph->fPackedID);
     void* dataPtr = storage.get();
     if (addPad) {
         sk_bzero(dataPtr, size);
         dataPtr = (char*)(dataPtr) + rowBytes + bytesPerPixel;
     }
-    if (!get_packed_glyph_image(cache, skGlyph, glyph->width(), glyph->height(),
+    if (!get_packed_glyph_image(skStrikeCache, skGlyph, glyph->width(), glyph->height(),
                                 rowBytes, expectedMaskFormat,
                                 dataPtr, glyphCache->getMasks())) {
         return GrDrawOpAtlas::ErrorCode::kError;
diff --git a/src/gpu/text/GrStrikeCache.h b/src/gpu/text/GrStrikeCache.h
index 831ea71..a3877a0 100644
--- a/src/gpu/text/GrStrikeCache.h
+++ b/src/gpu/text/GrStrikeCache.h
@@ -31,28 +31,29 @@
     GrTextStrike(const SkDescriptor& fontScalerKey);
 
     GrGlyph* getGlyph(const SkGlyph& skGlyph) {
-        GrGlyph* glyph = fCache.find(skGlyph.getPackedID());
-        if (!glyph) {
-            glyph = this->generateGlyph(skGlyph);
+        GrGlyph* grGlyph = fCache.find(skGlyph.getPackedID());
+        if (grGlyph == nullptr) {
+            grGlyph = fAlloc.make<GrGlyph>(skGlyph);
+            fCache.add(grGlyph);
         }
-        return glyph;
+        return grGlyph;
     }
 
     // This variant of the above function is called by GrAtlasTextOp. At this point, it is possible
     // 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
-    GrGlyph* getGlyph(SkPackedGlyphID packed,
-                      SkStrike* cache) {
-        GrGlyph* glyph = fCache.find(packed);
-        if (!glyph) {
+    GrGlyph* getGlyph(SkPackedGlyphID packed, SkStrike* skStrike) {
+        GrGlyph* grGlyph = fCache.find(packed);
+        if (grGlyph == nullptr) {
             // 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 = GrToSkGlyph(cache, packed);
-            glyph = this->generateGlyph(skGlyph);
+            const SkGlyph& skGlyph = skStrike->getGlyphIDMetrics(packed);
+            grGlyph = fAlloc.make<GrGlyph>(skGlyph);
+            fCache.add(grGlyph);
         }
-        return glyph;
+        return grGlyph;
     }
 
     // returns true if glyph successfully added to texture atlas, false otherwise.  If the glyph's
@@ -88,12 +89,6 @@
     int fAtlasedGlyphs{0};
     bool fIsAbandoned{false};
 
-    static const SkGlyph& GrToSkGlyph(SkStrike* cache, SkPackedGlyphID id) {
-        return cache->getGlyphIDMetrics(id.code(), id.getSubXFixed(), id.getSubYFixed());
-    }
-
-    GrGlyph* generateGlyph(const SkGlyph&);
-
     friend class GrStrikeCache;
 };