clean up conditional code for SkTextEncoding

Bug: skia:
Change-Id: I1e57a14b360d92651d4b41bc01891381431c8c4a
Reviewed-on: https://skia-review.googlesource.com/c/174583
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index 46d5336..2ad2b20 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -4080,7 +4080,7 @@
 blob contains Glyphs, their positions, and paint attributes specific to text:
 #paint_font_metrics#.
 
-Paint_Text_Encoding must be set to SkPaint::kGlyphID_TextEncoding.
+Paint_Text_Encoding must be set to kGlyphID_SkTextEncoding.
 
 Elements of paint: Anti_Alias, Blend_Mode, Color including Color_Alpha,
 Color_Filter, Paint_Dither, Draw_Looper, Mask_Filter, Path_Effect, Shader, and
@@ -4096,29 +4096,29 @@
 #Example
 #Height 120
 void draw(SkCanvas* canvas) {
-    SkTextBlobBuilder textBlobBuilder;

-    const char bunny[] = "/(^x^)\\";

-    const int len = sizeof(bunny) - 1;

-    uint16_t glyphs[len];

-    SkPaint paint;

-    paint.textToGlyphs(bunny, len, glyphs);

-    paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);

-    SkFont font;

-    int runs[] = { 3, 1, 3 };

-    SkPoint textPos = { 20, 100 };

-    int glyphIndex = 0;

-    for (auto runLen : runs) {

-        font.setSize(1 == runLen ? 20 : 50);

-        const SkTextBlobBuilder::RunBuffer& run =

-                textBlobBuilder.allocRun(font, runLen, textPos.fX, textPos.fY);

-        memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen);

-        paint.setTextSize(1 == runLen ? 20 : 50);

-        textPos.fX += paint.measureText(&glyphs[glyphIndex], sizeof(glyphs[0]) * runLen, nullptr);

-        glyphIndex += runLen;

-    }

-    sk_sp<const SkTextBlob> blob = textBlobBuilder.make();

-    paint.reset();

-    canvas->drawTextBlob(blob.get(), 0, 0, paint);

+    SkTextBlobBuilder textBlobBuilder;
+    const char bunny[] = "/(^x^)\\";
+    const int len = sizeof(bunny) - 1;
+    uint16_t glyphs[len];
+    SkPaint paint;
+    paint.textToGlyphs(bunny, len, glyphs);
+    paint.setTextEncoding(kGlyphID_SkTextEncoding);
+    SkFont font;
+    int runs[] = { 3, 1, 3 };
+    SkPoint textPos = { 20, 100 };
+    int glyphIndex = 0;
+    for (auto runLen : runs) {
+        font.setSize(1 == runLen ? 20 : 50);
+        const SkTextBlobBuilder::RunBuffer& run =
+                textBlobBuilder.allocRun(font, runLen, textPos.fX, textPos.fY);
+        memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen);
+        paint.setTextSize(1 == runLen ? 20 : 50);
+        textPos.fX += paint.measureText(&glyphs[glyphIndex], sizeof(glyphs[0]) * runLen, nullptr);
+        glyphIndex += runLen;
+    }
+    sk_sp<const SkTextBlob> blob = textBlobBuilder.make();
+    paint.reset();
+    canvas->drawTextBlob(blob.get(), 0, 0, paint);
 }
 ##
 
@@ -4135,7 +4135,7 @@
 blob contains Glyphs, their positions, and paint attributes specific to text:
 #paint_font_metrics#.
 
-Paint_Text_Encoding must be set to SkPaint::kGlyphID_TextEncoding.
+Paint_Text_Encoding must be set to kGlyphID_SkTextEncoding.
 
 Elements of paint: Path_Effect, Mask_Filter, Shader, Color_Filter,
 Image_Filter, and Draw_Looper; apply to blob.
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index 132c6e1..fd4532d 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -69,7 +69,7 @@
 # Path_Effect            # nullptr                  ##
 # Shader                 # nullptr                  ##
 # Style                  # kFill_Style              ##
-# Text_Encoding          # kUTF8_TextEncoding       ##
+# Text_Encoding          # kUTF8_SkTextEncoding     ##
 # Text_Scale_X           # 1                        ##
 # Text_Size              # 12                       ##
 # Text_Skew_X            # 0                        ##
@@ -3015,51 +3015,6 @@
 #Subtopic Text_Encoding
 #Line # text encoded as characters or Glyphs ##
 
-#Enum TextEncoding
-#Line # character or glyph encoded size ##
-
-#Code
-#Populate
-##
-
-TextEncoding determines whether text specifies character codes and their encoded
-size, or glyph indices. Characters are encoded as specified by the
-#A Unicode standard # https://unicode.org/standard/standard.html ##
-.
-
-Character codes encoded size are specified by UTF-8, UTF-16, or UTF-32.
-All character code formats are able to represent all of Unicode, differing only
-in the total storage required.
-
-#A UTF-8 (RFC 3629) # https://tools.ietf.org/html/rfc3629 ##
- encodes each character as one or more 8-bit bytes.
-
-#A UTF-16 (RFC 2781) # https://tools.ietf.org/html/rfc2781 ##
- encodes each character as one or two 16-bit words.
-
-#A UTF-32 # https://www.unicode.org/versions/Unicode5.0.0/ch03.pdf ##
- encodes each character as one 32-bit word.
-
-Font_Manager uses font data to convert character code points into glyph indices.
-A glyph index is a 16-bit word.
-
-TextEncoding is set to kUTF8_TextEncoding by default.
-
-#Const kUTF8_TextEncoding 0
-#Line # uses bytes to represent UTF-8 or ASCII ##
-##
-#Const kUTF16_TextEncoding 1
-#Line # uses two byte words to represent most of Unicode ##
-##
-#Const kUTF32_TextEncoding 2
-#Line # uses four byte words to represent all of Unicode ##
-##
-#Const kGlyphID_TextEncoding 3
-#Line # uses two byte words to represent glyph indices ##
-##
-
-#Enum ##
-
 #Example
 #Height 128
 #Description
@@ -3075,13 +3030,13 @@
     const uint32_t hello32[] = { 'H', 'e', 'l', 'l', 'o', 0x263A };
     paint.setTextSize(24);
     canvas->drawText(hello8, sizeof(hello8) - 1, 10, 30, paint);
-    paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
+    paint.setTextEncoding(kUTF16_SkTextEncoding);
     canvas->drawText(hello16, sizeof(hello16), 10, 60, paint);
-    paint.setTextEncoding(SkPaint::kUTF32_TextEncoding);
+    paint.setTextEncoding(kUTF32_SkTextEncoding);
     canvas->drawText(hello32, sizeof(hello32), 10, 90, paint);
     uint16_t glyphs[SK_ARRAY_COUNT(hello32)];
     paint.textToGlyphs(hello32, sizeof(hello32), glyphs);
-    paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+    paint.setTextEncoding(kGlyphID_SkTextEncoding);
     canvas->drawText(glyphs, sizeof(glyphs), 10, 120, paint);
 }
 ##
@@ -3094,15 +3049,15 @@
 
 #Example
         SkPaint paint;
-        SkDebugf("kUTF8_TextEncoding %c= text encoding\n",
-                SkPaint::kUTF8_TextEncoding == paint.getTextEncoding() ? '=' : '!');
-        paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
-        SkDebugf("kGlyphID_TextEncoding %c= text encoding\n",
-                SkPaint::kGlyphID_TextEncoding == paint.getTextEncoding() ? '=' : '!');
+        SkDebugf("kUTF8_SkTextEncoding %c= text encoding\n",
+                kUTF8_SkTextEncoding == paint.getTextEncoding() ? '=' : '!');
+        paint.setTextEncoding(kGlyphID_SkTextEncoding);
+        SkDebugf("kGlyphID_SkTextEncoding %c= text encoding\n",
+                kGlyphID_SkTextEncoding == paint.getTextEncoding() ? '=' : '!');
 
         #StdOut
-            kUTF8_TextEncoding == text encoding
-            kGlyphID_TextEncoding == text encoding
+            kUTF8_SkTextEncoding == text encoding
+            kGlyphID_SkTextEncoding == text encoding
         ##
     ##
 
@@ -3198,7 +3153,7 @@
             int count = paint.textToGlyphs(utf8, sizeof(utf8), nullptr);
             glyphs.resize(count);
             (void) paint.textToGlyphs(utf8, sizeof(utf8), &glyphs.front());
-            paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+            paint.setTextEncoding(kGlyphID_SkTextEncoding);
             paint.setTextSize(32);
             canvas->drawText(&glyphs.front(), glyphs.size() * sizeof(SkGlyphID), 10, 40, paint);
         }
@@ -3237,7 +3192,7 @@
         SkPaint paint;
         const uint16_t goodChar = 0x00B0;  // degree symbol
         const uint16_t badChar = 0xD800;   // Unicode surrogate
-        paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
+        paint.setTextEncoding(kUTF16_SkTextEncoding);
         SkDebugf("0x%04x %c= has char\n", goodChar,
                 paint.containsText(&goodChar, 2) ? '=' : '!');
         SkDebugf("0x%04x %c= has char\n", badChar,
@@ -3258,7 +3213,7 @@
         const uint16_t goodGlyph = 511;
         const uint16_t zeroGlyph = 0;
         const uint16_t badGlyph = 65535; // larger than glyph count in font
-        paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+        paint.setTextEncoding(kGlyphID_SkTextEncoding);
         SkDebugf("0x%04x %c= has glyph\n", goodGlyph,
                 paint.containsText(&goodGlyph, 2) ? '=' : '!');
         SkDebugf("0x%04x %c= has glyph\n", zeroGlyph,
@@ -3300,7 +3255,7 @@
         }
         SkUnichar unichars[count];
         paint.glyphsToUnichars(glyphs, count, unichars);
-        paint.setTextEncoding(SkPaint::kUTF32_TextEncoding);
+        paint.setTextEncoding(kUTF32_SkTextEncoding);
         canvas->drawText(unichars, sizeof(unichars), 10, 30, paint);
     }
     ##
diff --git a/docs/undocumented.bmh b/docs/undocumented.bmh
index 50ee7ab..1a434c1 100644
--- a/docs/undocumented.bmh
+++ b/docs/undocumented.bmh
@@ -338,6 +338,26 @@
 ##
 #Const kGlyphID_SkTextEncoding 3
 ##
+TextEncoding determines whether text specifies character codes and their encoded
+size, or glyph indices. Characters are encoded as specified by the
+#A Unicode standard # https://unicode.org/standard/standard.html ##
+.
+
+Character codes encoded size are specified by UTF-8, UTF-16, or UTF-32.
+All character code formats are able to represent all of Unicode, differing only
+in the total storage required.
+
+#A UTF-8 (RFC 3629) # https://tools.ietf.org/html/rfc3629 ##
+encodes each character as one or more 8-bit bytes.
+
+#A UTF-16 (RFC 2781) # https://tools.ietf.org/html/rfc2781 ##
+encodes each character as one or two 16-bit words.
+
+#A UTF-32 # https://www.unicode.org/versions/Unicode5.0.0/ch03.pdf ##
+encodes each character as one 32-bit word.
+
+Font_Manager uses font data to convert character code points into glyph indices.
+A glyph index is a 16-bit word.
 ##
 
 #EnumClass SkFontHinting
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp
index 7ba1961..471f9cd 100644
--- a/fuzz/FuzzCanvas.cpp
+++ b/fuzz/FuzzCanvas.cpp
@@ -975,8 +975,7 @@
 }
 
 static SkTDArray<uint8_t> make_fuzz_text(Fuzz* fuzz, const SkPaint& paint) {
-    return make_fuzz_text(fuzz, SkFont::LEGACY_ExtractFromPaint(paint),
-                          (SkTextEncoding)paint.getTextEncoding());
+    return make_fuzz_text(fuzz, SkFont::LEGACY_ExtractFromPaint(paint), paint.getTextEncoding());
 }
 
 static sk_sp<SkTextBlob> make_fuzz_textblob(Fuzz* fuzz) {
diff --git a/gm/typeface.cpp b/gm/typeface.cpp
index 5ea0618..22967f1 100644
--- a/gm/typeface.cpp
+++ b/gm/typeface.cpp
@@ -19,7 +19,7 @@
 
 static void getGlyphPositions(const SkPaint& paint, const uint16_t glyphs[],
                              int count, SkScalar x, SkScalar y, SkPoint pos[]) {
-    SkASSERT(kGlyphID_SkTextEncoding == (SkTextEncoding)paint.getTextEncoding());
+    SkASSERT(kGlyphID_SkTextEncoding == paint.getTextEncoding());
 
     SkAutoSTMalloc<128, SkScalar> widthStorage(count);
     SkScalar* widths = widthStorage.get();
diff --git a/include/core/SkFontTypes.h b/include/core/SkFontTypes.h
index 912e7de..6a453a6 100644
--- a/include/core/SkFontTypes.h
+++ b/include/core/SkFontTypes.h
@@ -8,28 +8,19 @@
 #ifndef SkFontTypes_DEFINED
 #define SkFontTypes_DEFINED
 
-#include "SkScalar.h"
-#include "SkTypeface.h"
+#include "SkTypes.h"
 
-#ifdef SK_SUPPORT_LEGACY_TEXTENCODINGENUM
-enum SkTextEncoding : uint8_t {
-    kUTF8_SkTextEncoding,
-    kUTF16_SkTextEncoding,
-    kUTF32_SkTextEncoding,
-    kGlyphID_SkTextEncoding,
-};
-#else
 enum class SkTextEncoding {
-    kUTF8,
-    kUTF16,
-    kUTF32,
-    kGlyphID,
+    kUTF8,      //!< uses bytes to represent UTF-8 or ASCII
+    kUTF16,     //!< uses two byte words to represent most of Unicode
+    kUTF32,     //!< uses four byte words to represent all of Unicode
+    kGlyphID,   //!< uses two byte words to represent glyph indices
 };
+
 #define kUTF8_SkTextEncoding    SkTextEncoding::kUTF8
 #define kUTF16_SkTextEncoding   SkTextEncoding::kUTF16
 #define kUTF32_SkTextEncoding   SkTextEncoding::kUTF32
 #define kGlyphID_SkTextEncoding SkTextEncoding::kGlyphID
-#endif
 
 enum class SkFontHinting {
     kNone,      //!< glyph outlines unchanged
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index eea5e8c..88d88a1 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -875,59 +875,11 @@
     */
     void setTextSkewX(SkScalar skewX);
 
-#ifdef SK_SUPPORT_LEGACY_TEXTENCODINGENUM
-    /** \enum SkPaint::TextEncoding
-        TextEncoding determines whether text specifies character codes and their encoded
-        size, or glyph indices. Characters are encoded as specified by the Unicode standard.
-
-        Character codes encoded size are specified by UTF-8, UTF-16, or UTF-32.
-        All character code formats are able to represent all of Unicode, differing only
-        in the total storage required.
-
-        UTF-8 (RFC 3629) encodes each character as one or more 8-bit bytes.
-
-        UTF-16 (RFC 2781) encodes each character as one or two 16-bit words.
-
-        UTF-32 encodes each character as one 32-bit word.
-
-        font manager uses font data to convert character code points into glyph indices.
-        A glyph index is a 16-bit word.
-
-        TextEncoding is set to kUTF8_TextEncoding by default.
-    */
-    enum TextEncoding : uint8_t {
-        kUTF8_TextEncoding,    //!< uses bytes to represent UTF-8 or ASCII
-        kUTF16_TextEncoding,   //!< uses two byte words to represent most of Unicode
-        kUTF32_TextEncoding,   //!< uses four byte words to represent all of Unicode
-        kGlyphID_TextEncoding, //!< uses two byte words to represent glyph indices
-    };
-
-    /** Returns SkPaint::TextEncoding.
-        SkPaint::TextEncoding determines how character code points are mapped to font glyph indices.
-
-        @return  one of: kUTF8_TextEncoding, kUTF16_TextEncoding, kUTF32_TextEncoding, or
-                 kGlyphID_TextEncoding
-    */
-    TextEncoding getTextEncoding() const {
-      return (TextEncoding)fBitfields.fTextEncoding;
-    }
-
-    /** Sets SkPaint::TextEncoding to encoding.
-        SkPaint::TextEncoding determines how character code points are mapped to font glyph indices.
-        Invalid values for encoding are ignored.
-
-        @param encoding  one of: kUTF8_TextEncoding, kUTF16_TextEncoding, kUTF32_TextEncoding, or
-                         kGlyphID_TextEncoding
-    */
-    void setTextEncoding(TextEncoding encoding) {
-        this->setTextEncoding((SkTextEncoding)encoding);
-    }
-#else
     // Experimental
     SkTextEncoding getTextEncoding() const {
         return (SkTextEncoding)fBitfields.fTextEncoding;
     }
-#endif
+
     // Experimental
     void setTextEncoding(SkTextEncoding encoding);
 
diff --git a/src/core/SkGlyphRun.cpp b/src/core/SkGlyphRun.cpp
index 1e487e3..8449756 100644
--- a/src/core/SkGlyphRun.cpp
+++ b/src/core/SkGlyphRun.cpp
@@ -309,7 +309,7 @@
 
 SkSpan<const SkGlyphID> SkGlyphRunBuilder::textToGlyphIDs(
         const SkPaint& paint, const void* bytes, size_t byteLength) {
-    SkTextEncoding encoding = (SkTextEncoding)paint.getTextEncoding();
+    SkTextEncoding encoding = paint.getTextEncoding();
     if (encoding != kGlyphID_SkTextEncoding) {
         auto tfEncoding = convert_encoding(encoding);
         int utfSize = SkUTFN_CountUnichars(tfEncoding, bytes, byteLength);
diff --git a/src/core/SkOverdrawCanvas.cpp b/src/core/SkOverdrawCanvas.cpp
index 0d3596e..60ab1fb 100644
--- a/src/core/SkOverdrawCanvas.cpp
+++ b/src/core/SkOverdrawCanvas.cpp
@@ -75,7 +75,7 @@
     auto cache = SkStrikeCache::FindOrCreateStrikeExclusive(
                                 SkFont::LEGACY_ExtractFromPaint(paint), paint, props,
                                 SkScalerContextFlags::kNone, this->getTotalMatrix());
-    SkFindAndPlaceGlyph::ProcessPosText((SkTextEncoding)paint.getTextEncoding(),
+    SkFindAndPlaceGlyph::ProcessPosText(paint.getTextEncoding(),
                                         (const char*)text, byteLength,
                                         SkPoint::Make(0, 0), SkMatrix(), (const SkScalar*) pos, 2,
                                         cache.get(), processBounds);
@@ -110,7 +110,7 @@
                                          const SkPaint& paint) {
     const char* stop = (const char*)text + byteLength;
     CountTextProc proc = nullptr;
-    switch ((SkTextEncoding)paint.getTextEncoding()) {
+    switch (paint.getTextEncoding()) {
         case kUTF8_SkTextEncoding:
             proc = count_utf8;
             break;
diff --git a/src/core/SkPaint_text.cpp b/src/core/SkPaint_text.cpp
index 0f79efe..47ac73f 100644
--- a/src/core/SkPaint_text.cpp
+++ b/src/core/SkPaint_text.cpp
@@ -62,19 +62,18 @@
 #include "SkUtils.h"
 
 int SkPaint::countText(const void* text, size_t length) const {
-    return SkFont::LEGACY_ExtractFromPaint(*this).countText(text, length,
-                                                        (SkTextEncoding)this->getTextEncoding());
+    return SkFont::LEGACY_ExtractFromPaint(*this).countText(text, length, this->getTextEncoding());
 }
 
 int SkPaint::textToGlyphs(const void* text, size_t length, uint16_t glyphs[]) const {
     return SkFont::LEGACY_ExtractFromPaint(*this).textToGlyphs(text, length,
-                                                           (SkTextEncoding)this->getTextEncoding(),
+                                                               this->getTextEncoding(),
                                                                glyphs, length);
 }
 
 bool SkPaint::containsText(const void* text, size_t length) const {
     return SkFont::LEGACY_ExtractFromPaint(*this).containsText(text, length,
-                                                           (SkTextEncoding)this->getTextEncoding());
+                                                               this->getTextEncoding());
 }
 
 void SkPaint::glyphsToUnichars(const uint16_t glyphs[], int count, SkUnichar textData[]) const {
@@ -286,7 +285,7 @@
     }
 
     SkFontPriv::GlyphCacheProc glyphCacheProc = SkFontPriv::GetGlyphCacheProc(
-                    static_cast<SkTextEncoding>(this->getTextEncoding()), nullptr != bounds);
+                                                    this->getTextEncoding(), nullptr != bounds);
 
     int         n = 1;
     const char* stop = (const char*)text + byteLength;
@@ -348,7 +347,7 @@
 size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
                           SkScalar* measuredWidth) const {
     return SkFont::LEGACY_ExtractFromPaint(*this).breakText(textD, length,
-                            (SkTextEncoding)this->getTextEncoding(), maxWidth, measuredWidth);
+                                                this->getTextEncoding(), maxWidth, measuredWidth);
 }
 
 SkScalar SkPaint::getFontMetrics(SkFontMetrics* metrics) const {
@@ -359,7 +358,7 @@
 
 int SkPaint::getTextWidths(const void* text, size_t len, SkScalar widths[], SkRect bounds[]) const {
     const SkFont font = SkFont::LEGACY_ExtractFromPaint(*this);
-    SkAutoToGlyphs gly(font, text, len, (SkTextEncoding)this->getTextEncoding());
+    SkAutoToGlyphs gly(font, text, len, this->getTextEncoding());
     font.getWidthsBounds(gly.glyphs(), gly.count(), widths, bounds, this);
     return gly.count();
 }
@@ -385,7 +384,7 @@
 void SkPaint::getTextPath(const void* text, size_t length,
                           SkScalar x, SkScalar y, SkPath* path) const {
     SkFont font = SkFont::LEGACY_ExtractFromPaint(*this);
-    SkAutoToGlyphs gly(font, text, length, (SkTextEncoding)this->getTextEncoding());
+    SkAutoToGlyphs gly(font, text, length, this->getTextEncoding());
     SkAutoSTArray<32, SkPoint> fPos(gly.count());
     font.getPos(gly.glyphs(), gly.count(), fPos.get(), {x, y});
 
@@ -397,7 +396,7 @@
 void SkPaint::getPosTextPath(const void* text, size_t length,
                              const SkPoint pos[], SkPath* path) const {
     SkFont font = SkFont::LEGACY_ExtractFromPaint(*this);
-    SkAutoToGlyphs gly(font, text, length, (SkTextEncoding)this->getTextEncoding());
+    SkAutoToGlyphs gly(font, text, length, this->getTextEncoding());
 
     path->reset();
     PathPosRec rec = { path, pos };
@@ -527,8 +526,7 @@
                                    const SkPaint& paint,
                                    bool applyStrokeAndPathEffects)
     : fPaint(paint) {
-    fGlyphCacheProc = SkFontPriv::GetGlyphCacheProc(
-                                    static_cast<SkTextEncoding>(paint.getTextEncoding()), true);
+    fGlyphCacheProc = SkFontPriv::GetGlyphCacheProc(paint.getTextEncoding(), true);
 
     fPaint.setLinearText(true);
     fPaint.setMaskFilter(nullptr);   // don't want this affecting our path-cache lookup
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index c204b5d..553a461 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -78,7 +78,7 @@
                     fCount = 0;
                 } else {
                     fCount = SkPaintPriv::ValidCountText(fText, fByteLength,
-                                                         (SkTextEncoding)paint->getTextEncoding());
+                                                         paint->getTextEncoding());
                     reader->validate(fCount > 0);
                 }
             }
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index aa8bd69..91398ed 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -480,9 +480,7 @@
                                       SkTextBlob::GlyphPositioning positioning,
                                       int count, int textSize, SkPoint offset,
                                       const SkRect* bounds) {
-    if (count <= 0 || textSize < 0 ||
-        (SkTextEncoding)font.getTextEncoding() != kGlyphID_SkTextEncoding)
-    {
+    if (count <= 0 || textSize < 0 || font.getTextEncoding() != kGlyphID_SkTextEncoding) {
         fCurrentRunBuffer = { nullptr, nullptr, nullptr, nullptr };
         return;
     }
diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp
index c9c60cc..a0b5006 100644
--- a/src/effects/SkLayerDrawLooper.cpp
+++ b/src/effects/SkLayerDrawLooper.cpp
@@ -79,7 +79,7 @@
                     sk_srgb_singleton());
 
     BitFlags bits = info.fPaintBits;
-    SkTextEncoding encoding = (SkTextEncoding)dst->getTextEncoding();
+    SkTextEncoding encoding = dst->getTextEncoding();
 
     if (0 == bits) {
         return;
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index 7f279ca..28096a4 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -37,11 +37,6 @@
         lua_settop(L, -1);
     }
 
-#ifdef SK_SUPPORT_LEGACY_TEXTENCODINGENUM
-    void pushEncodedText(SkPaint::TextEncoding enc, const void* text, size_t length) {
-        this->pushEncodedText((SkTextEncoding)enc, text, length);
-    }
-#endif
     void pushEncodedText(SkTextEncoding, const void*, size_t);
 
 private:
diff --git a/src/utils/SkTextUtils.cpp b/src/utils/SkTextUtils.cpp
index f33058e..e588d3c 100644
--- a/src/utils/SkTextUtils.cpp
+++ b/src/utils/SkTextUtils.cpp
@@ -18,7 +18,7 @@
     SkAutoSTArray<32, uint16_t> glyphStorage;
     const uint16_t* glyphs;
 
-    if ((SkTextEncoding)paint.getTextEncoding() != kGlyphID_SkTextEncoding) {
+    if (paint.getTextEncoding() != kGlyphID_SkTextEncoding) {
         glyphStorage.reset(count);
         paint.textToGlyphs(text, size, glyphStorage.get());
         glyphs = glyphStorage.get();
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index e4da0a0..7d27221 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -96,7 +96,7 @@
 
         SkPaint paint;
         paint.setTypeface(face);
-        paint.setTextEncoding((SkTextEncoding)test.typefaceEncoding);
+        paint.setTextEncoding(static_cast<SkTextEncoding>(test.typefaceEncoding));
         paint.textToGlyphs(test.chars, test.charsByteLength, paintGlyphIds);
 
         face->charsToGlyphs(test.chars, test.typefaceEncoding, faceGlyphIds, test.charCount);
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index e33f91d..d4c0b6b 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -48,7 +48,7 @@
 }
 
 static SkTypeface::Encoding paint2encoding(const SkPaint& paint) {
-    SkTextEncoding enc = (SkTextEncoding)paint.getTextEncoding();
+    SkTextEncoding enc = paint.getTextEncoding();
     SkASSERT(kGlyphID_SkTextEncoding != enc);
     return (SkTypeface::Encoding)enc;
 }
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 35c059f..ba9bd7c 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -140,8 +140,8 @@
     SkFont font = SkFont::LEGACY_ExtractFromPaint(paint);
     SkTDArray<uint16_t> glyphs;
 
-    glyphs.append(font.countText(text, len, (SkTextEncoding)paint.getTextEncoding()));
-    font.textToGlyphs(text, len, (SkTextEncoding)paint.getTextEncoding(), glyphs.begin(), glyphs.count());
+    glyphs.append(font.countText(text, len, paint.getTextEncoding()));
+    font.textToGlyphs(text, len, paint.getTextEncoding(), glyphs.begin(), glyphs.count());
 
     const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(font, glyphs.count(), x, y,
                                                                 nullptr);