SkAdvancedTypefaceMetrics: factor out GlyphToUnicode

Change-Id: Iedce8c1ea2c405d5ab64ccac353970d5cd2b9d63
Reviewed-on: https://skia-review.googlesource.com/126507
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/src/pdf/SkPDFMakeToUnicodeCmap.cpp b/src/pdf/SkPDFMakeToUnicodeCmap.cpp
index afe7732..c93aa6f 100644
--- a/src/pdf/SkPDFMakeToUnicodeCmap.cpp
+++ b/src/pdf/SkPDFMakeToUnicodeCmap.cpp
@@ -147,15 +147,12 @@
 // For the worst case (having 65536 continuous unicode and we use every other
 // one of them), the possible savings by aggressive optimization is 416KB
 // pre-compressed and does not provide enough motivation for implementation.
-void SkPDFAppendCmapSections(const SkTDArray<SkUnichar>& glyphToUnicode,
+void SkPDFAppendCmapSections(const SkUnichar* glyphToUnicode,
                              const SkBitSet* subset,
                              SkDynamicMemoryWStream* cmap,
                              bool multiByteGlyphs,
                              SkGlyphID firstGlyphID,
                              SkGlyphID lastGlyphID) {
-    if (glyphToUnicode.isEmpty()) {
-        return;
-    }
     int glyphOffset = 0;
     if (!multiByteGlyphs) {
         glyphOffset = firstGlyphID - 1;
@@ -166,8 +163,7 @@
 
     BFRange currentRangeEntry = {0, 0, 0};
     bool rangeEmpty = true;
-    const int limit =
-            SkMin32(lastGlyphID + 1, glyphToUnicode.count()) - glyphOffset;
+    const int limit = (int)lastGlyphID + 1 - glyphOffset;
 
     for (int i = firstGlyphID - glyphOffset; i < limit + 1; ++i) {
         bool inSubset = i < limit &&
@@ -210,7 +206,7 @@
 }
 
 sk_sp<SkPDFStream> SkPDFMakeToUnicodeCmap(
-        const SkTDArray<SkUnichar>& glyphToUnicode,
+        const SkUnichar* glyphToUnicode,
         const SkBitSet* subset,
         bool multiByteGlyphs,
         SkGlyphID firstGlyphID,