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