move GlyphCacheProc into fontpriv

Bug: skia:2664
Change-Id: I55c84cfae33f8861d66c7a500b940225c1ba8107
Reviewed-on: https://skia-review.googlesource.com/c/170277
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index c0ed311..c2dbfe8 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -1329,7 +1329,6 @@
     friend class SkGlyphRun;
     friend class SkGlyphRunBuilder;
     SkPaint(const SkPaint&, const SkRunFont&);
-    typedef const SkGlyph& (*GlyphCacheProc)(SkGlyphCache*, const char**, const char*);
 
     sk_sp<SkTypeface>     fTypeface;
     sk_sp<SkPathEffect>   fPathEffect;
@@ -1361,9 +1360,6 @@
         uint32_t fBitfieldsUInt;
     };
 
-    static GlyphCacheProc GetGlyphCacheProc(TextEncoding encoding,
-                                            bool needFullMetrics);
-
     SkScalar measure_text(SkGlyphCache*, const char* text, size_t length,
                           int* count, SkRect* bounds) const;
 
diff --git a/src/core/SkFontPriv.h b/src/core/SkFontPriv.h
index e769321..97dd213 100644
--- a/src/core/SkFontPriv.h
+++ b/src/core/SkFontPriv.h
@@ -42,8 +42,9 @@
         return font.getTypeface() ? font.refTypeface() : SkTypeface::MakeDefault();
     }
 
-//    static void Flatten(const SkFont& font, SkWriteBuffer& buffer);
-//    static bool Unflatten(SkFont* font, SkReadBuffer& buffer);
+    typedef const SkGlyph& (*GlyphCacheProc)(SkGlyphCache*, const char**, const char*);
+
+    static GlyphCacheProc GetGlyphCacheProc(SkTextEncoding encoding, bool needFullMetrics);
 };
 
 #endif
diff --git a/src/core/SkPaint_text.cpp b/src/core/SkPaint_text.cpp
index 47f7891..eda6fc3 100644
--- a/src/core/SkPaint_text.cpp
+++ b/src/core/SkPaint_text.cpp
@@ -249,8 +249,8 @@
     return cache->getGlyphIDAdvance(glyphID);
 }
 
-SkPaint::GlyphCacheProc SkPaint::GetGlyphCacheProc(TextEncoding encoding,
-                                                  bool needFullMetrics) {
+SkFontPriv::GlyphCacheProc SkFontPriv::GetGlyphCacheProc(SkTextEncoding encoding,
+                                                         bool needFullMetrics) {
     static const GlyphCacheProc gGlyphCacheProcs[] = {
         sk_getMetrics_utf8_next,
         sk_getMetrics_utf16_next,
@@ -355,8 +355,8 @@
         return 0;
     }
 
-    GlyphCacheProc glyphCacheProc = SkPaint::GetGlyphCacheProc(this->getTextEncoding(),
-                                                               nullptr != bounds);
+    SkFontPriv::GlyphCacheProc glyphCacheProc = SkFontPriv::GetGlyphCacheProc(
+                    static_cast<SkTextEncoding>(this->getTextEncoding()), nullptr != bounds);
 
     int         n = 1;
     const char* stop = (const char*)text + byteLength;
@@ -445,9 +445,9 @@
 
     auto cache = SkStrikeCache::FindOrCreateStrikeWithNoDeviceExclusive(paint);
 
-    GlyphCacheProc   glyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(),
-                                                                 false);
-    SkScalar         width = 0;
+    SkFontPriv::GlyphCacheProc glyphCacheProc = SkFontPriv::GetGlyphCacheProc(
+                                  static_cast<SkTextEncoding>(paint.getTextEncoding()), false);
+    SkScalar width = 0;
 
     while (text < stop) {
         const char* curr = text;
@@ -527,8 +527,8 @@
     SkScalar scale = canon.getScale();
 
     auto cache = SkStrikeCache::FindOrCreateStrikeWithNoDeviceExclusive(paint);
-    GlyphCacheProc      glyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(),
-                                                                    nullptr != bounds);
+    SkFontPriv::GlyphCacheProc glyphCacheProc = SkFontPriv::GetGlyphCacheProc(
+                      static_cast<SkTextEncoding>(paint.getTextEncoding()), nullptr != bounds);
 
     const char* text = (const char*)textData;
     const char* stop = text + byteLength;
@@ -758,7 +758,8 @@
                                    const SkPaint& paint,
                                    bool applyStrokeAndPathEffects)
     : fPaint(paint) {
-    fGlyphCacheProc = SkPaint::GetGlyphCacheProc(paint.getTextEncoding(), true);
+    fGlyphCacheProc = SkFontPriv::GetGlyphCacheProc(
+                                    static_cast<SkTextEncoding>(paint.getTextEncoding()), true);
 
     fPaint.setLinearText(true);
     fPaint.setMaskFilter(nullptr);   // don't want this affecting our path-cache lookup
diff --git a/src/core/SkTextToPathIter.h b/src/core/SkTextToPathIter.h
index a64a7a1..92ddff2 100644
--- a/src/core/SkTextToPathIter.h
+++ b/src/core/SkTextToPathIter.h
@@ -8,6 +8,7 @@
 #ifndef SkTextToPathIter_DEFINED
 #define SkTextToPathIter_DEFINED
 
+#include "SkFontPriv.h"
 #include "SkPaint.h"
 #include "SkStrikeCache.h"
 
@@ -22,7 +23,7 @@
     SkScalar             fPrevAdvance;
     const char*          fText;
     const char*          fStop;
-    SkPaint::GlyphCacheProc fGlyphCacheProc;
+    SkFontPriv::GlyphCacheProc fGlyphCacheProc;
 
     SkScalar        fXPos;      // accumulated xpos, returned in next
 };