Revert "Draw perspective text as paths."

This reverts commit 76826fc91c0abcbd1c8aa4dbc3db4a9d9419e73f.

Reason for revert: Missing some characters

Original change's description:
> Draw perspective text as paths.
> 
> Perspective glyphs can vary in screen size so it's unclear which SDF
> level is best, and even if we choose one for an entire subrun it's
> possible that a given glyph will have artifacts if it's too big.
> Instead we fall back to paths.
> 
> Bug: skia:9515
> Change-Id: I88f03b25651df0222459f5dbd03eee9465b97487
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247437
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>

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

Change-Id: I5e39566c35b49323913eb72ff89ecbc91faac8ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9515
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247462
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/core/SkStrikeSpec.cpp b/src/core/SkStrikeSpec.cpp
index 79ff872..65adf83 100644
--- a/src/core/SkStrikeSpec.cpp
+++ b/src/core/SkStrikeSpec.cpp
@@ -181,7 +181,6 @@
                        const SkSurfaceProps& surfaceProps, const SkMatrix& deviceMatrix,
                        const GrTextContext::Options& options) {
     SkStrikeSpec storage;
-    SkASSERT(!deviceMatrix.hasPerspective());
 
     SkPaint dfPaint = GrTextContext::InitDistanceFieldPaint(paint);
     SkFont dfFont = GrTextContext::InitDistanceFieldFont(
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 2f7b5bf..6d8151c 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -95,8 +95,24 @@
                                             const SkSurfaceProps& props,
                                             bool contextSupportsDistanceFieldText,
                                             const Options& options) {
-    if (viewMatrix.hasPerspective()) {
-        return false;
+    if (!viewMatrix.hasPerspective()) {
+        SkScalar maxScale = viewMatrix.getMaxScale();
+        SkScalar scaledTextSize = maxScale * font.getSize();
+        // Hinted text looks far better at small resolutions
+        // Scaling up beyond 2x yields undesireable artifacts
+        if (scaledTextSize < options.fMinDistanceFieldFontSize ||
+            scaledTextSize > options.fMaxDistanceFieldFontSize) {
+            return false;
+        }
+
+        bool useDFT = props.isUseDeviceIndependentFonts();
+#if SK_FORCE_DISTANCE_FIELD_TEXT
+        useDFT = true;
+#endif
+
+        if (!useDFT && scaledTextSize < kLargeDFFontSize) {
+            return false;
+        }
     }
 
     // mask filters modify alpha, which doesn't translate well to distance
@@ -109,38 +125,24 @@
         return false;
     }
 
-    SkScalar maxScale = viewMatrix.getMaxScale();
-    SkScalar scaledTextSize = maxScale * font.getSize();
-    // Hinted text looks far better at small resolutions
-    // Scaling up beyond 2x yields undesirable artifacts
-    if (scaledTextSize < options.fMinDistanceFieldFontSize ||
-        scaledTextSize > options.fMaxDistanceFieldFontSize) {
-        return false;
-    }
-
-    bool useDFT = props.isUseDeviceIndependentFonts();
-#if SK_FORCE_DISTANCE_FIELD_TEXT
-    useDFT = true;
-#endif
-
-    if (!useDFT && scaledTextSize < kLargeDFFontSize) {
-        return false;
-    }
-
     return true;
 }
 
 SkScalar scaled_text_size(const SkScalar textSize, const SkMatrix& viewMatrix) {
-    SkASSERT(!viewMatrix.hasPerspective());
-
     SkScalar scaledTextSize = textSize;
 
-    SkScalar maxScale = viewMatrix.getMaxScale();
-    // if we have non-unity scale, we need to choose our base text size
-    // based on the SkPaint's text size multiplied by the max scale factor
-    // TODO: do we need to do this if we're scaling down (i.e. maxScale < 1)?
-    if (maxScale > 0 && !SkScalarNearlyEqual(maxScale, SK_Scalar1)) {
-        scaledTextSize *= maxScale;
+    if (viewMatrix.hasPerspective()) {
+        // for perspective, we simply force to the medium size
+        // TODO: compute a size based on approximate screen area
+        scaledTextSize = kMediumDFFontLimit;
+    } else {
+        SkScalar maxScale = viewMatrix.getMaxScale();
+        // if we have non-unity scale, we need to choose our base text size
+        // based on the SkPaint's text size multiplied by the max scale factor
+        // TODO: do we need to do this if we're scaling down (i.e. maxScale < 1)?
+        if (maxScale > 0 && !SkScalarNearlyEqual(maxScale, SK_Scalar1)) {
+            scaledTextSize *= maxScale;
+        }
     }
 
     return scaledTextSize;
diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp
index 7ffc68a..92e1fec 100644
--- a/tests/SkRemoteGlyphCacheTest.cpp
+++ b/tests/SkRemoteGlyphCacheTest.cpp
@@ -678,8 +678,10 @@
     SkPaint paint;
     SkFont font;
 
-    // A scale transform forces fallback to dft.
-    SkMatrix matrix = SkMatrix::MakeScale(16);
+    // A perspective transform forces fallback to dft.
+    SkMatrix matrix = SkMatrix::I();
+    matrix[SkMatrix::kMPersp0] = 0.5f;
+    REPORTER_ASSERT(reporter, matrix.hasPerspective());
     SkSurfaceProps surfaceProps(0, kUnknown_SkPixelGeometry);
     GrTextContext::Options options;
     GrTextContext::SanitizeOptions(&options);