align prepareForMaskDrawing to agree for remote and gpu

The prepareForMaskDrawing in the RemoteStrike and the SkScalerCache
must fully agree on the maximum dimensions calculations.

Bug: chromium:1280180

Change-Id: Idfe98618027e5b04a481fa55f27e10b5bb048aea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494580
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/core/SkChromeRemoteGlyphCache.cpp b/src/core/SkChromeRemoteGlyphCache.cpp
index 1bf3c29..369465d 100644
--- a/src/core/SkChromeRemoteGlyphCache.cpp
+++ b/src/core/SkChromeRemoteGlyphCache.cpp
@@ -489,8 +489,17 @@
         }
 
         // Reject things that are too big.
+        // Only collect dimensions of the color glyphs assuming that paths will take care
+        // of the large mask glyphs. This may be inaccurate in the very rare case where
+        // a bitmap only font is being used.
+        // N.B. this must have the same behavior as SkScalerCache::prepareForMaskDrawing.
         if (!digest->canDrawAsMask()) {
-            rejects->reject(i);
+            if (digest->isColor()) {
+                // Paths can't handle color, so these will fall to the drawing of last resort.
+                rejects->reject(i, digest->maxDimension());
+            } else {
+                rejects->reject(i);
+            }
         }
     }
 }
diff --git a/src/core/SkScalerCache.cpp b/src/core/SkScalerCache.cpp
index 7194f70..b1fa70c 100644
--- a/src/core/SkScalerCache.cpp
+++ b/src/core/SkScalerCache.cpp
@@ -195,8 +195,12 @@
             if (digest.canDrawAsMask()) {
                 drawables->push_back(fGlyphForIndex[digest.index()], i);
             } else {
-                // Accumulate maximum dimensions for handling emoji scaling.
+                // Only collect dimensions of the color glyphs assuming that paths will take care
+                // of the large mask glyphs. This may be inaccurate in the very rare case where
+                // a bitmap only font is being used.
+                // N.B. this must have the same behavior as RemoteStrike::prepareForMaskDrawing.
                 if (digest.isColor()) {
+                    // Paths can't handle color, so these will fall to the drawing of last resort.
                     rejects->reject(i, digest.maxDimension());
                 } else {
                     rejects->reject(i);