fonts: Hook up FallbackTextHelper to font remoting.

Use GrContext::FallbackTextHelper in SkTextBlobCacheDiffCanvas to
replicate glyph generation logic for fallback text during analysis. This
ensures that we correctly handle these fallback cases when using
distance field or paths for text rendering.

R=herb@google.com, jvanverth@google.com

Bug: skia:7913
Change-Id: I3067c4f1bd09231a564ac7c4cd89efcb876d2abd
Reviewed-on: https://skia-review.googlesource.com/132285
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
diff --git a/src/gpu/text/GrTextContext.h b/src/gpu/text/GrTextContext.h
index 7d31d84..478d4c4 100644
--- a/src/gpu/text/GrTextContext.h
+++ b/src/gpu/text/GrTextContext.h
@@ -69,21 +69,18 @@
                                        SkScalar* textRatio,
                                        SkScalerContextFlags* flags);
 
-private:
-    GrTextContext(const Options& options);
-
     class FallbackTextHelper {
     public:
         FallbackTextHelper(const SkMatrix& viewMatrix,
                            const SkPaint& pathPaint,
-                           const GrGlyphCache* glyphCache,
+                           SkScalar maxTextSize,
                            SkScalar textRatio)
-            : fViewMatrix(viewMatrix)
-            , fTextSize(pathPaint.getTextSize())
-            , fMaxTextSize(glyphCache->getGlyphSizeLimit())
-            , fTextRatio(textRatio)
-            , fTransformedFallbackTextSize(fMaxTextSize)
-            , fUseTransformedFallback(false) {
+                : fViewMatrix(viewMatrix)
+                , fTextSize(pathPaint.getTextSize())
+                , fMaxTextSize(maxTextSize)
+                , fTextRatio(textRatio)
+                , fTransformedFallbackTextSize(fMaxTextSize)
+                , fUseTransformedFallback(false) {
             fMaxScale = viewMatrix.getMaxScale();
         }
 
@@ -91,6 +88,9 @@
         void drawText(GrTextBlob* blob, int runIndex, GrGlyphCache*, const SkSurfaceProps&,
                       const GrTextUtils::Paint&, SkScalerContextFlags);
 
+        void initializeForDraw(SkPaint* paint, SkScalar* textRatio, SkMatrix* matrix) const;
+        const SkTDArray<char>& fallbackText() const { return fFallbackTxt; }
+
     private:
         SkTDArray<char> fFallbackTxt;
         SkTDArray<SkPoint> fFallbackPos;
@@ -104,6 +104,9 @@
         bool fUseTransformedFallback;
     };
 
+private:
+    GrTextContext(const Options& options);
+
     // sets up the descriptor on the blob and returns a detached cache.  Client must attach
     static SkColor ComputeCanonicalColor(const SkPaint&, bool lcd);
     // Determines if we need to use fake gamma (and contrast boost):