textonpath no longer in canvas

Prev behavior available via utils SkDrawTextOnPath

Bug: skia:7554
Change-Id: I3d71963c632cc947e418757bb83cdc18ec3b184e
Reviewed-on: https://skia-review.googlesource.com/150123
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp
index 58cfcde..9627be7 100644
--- a/fuzz/FuzzCanvas.cpp
+++ b/fuzz/FuzzCanvas.cpp
@@ -59,6 +59,7 @@
 #include "SkReadBuffer.h"
 #include "SkTableColorFilter.h"
 #include "SkTextBlob.h"
+#include "SkTextOnPath.h"
 #include "SkTileImageFilter.h"
 #include "SkXfermodeImageFilter.h"
 
@@ -1596,8 +1597,8 @@
                 FuzzPath(fuzz, &path, 20);
                 SkScalar hOffset, vOffset;
                 fuzz->next(&hOffset, &vOffset);
-                canvas->drawTextOnPathHV(text.begin(), SkToSizeT(text.count()), path, hOffset,
-                                         vOffset, paint);
+                SkDrawTextOnPathHV(text.begin(), SkToSizeT(text.count()), paint, path, hOffset,
+                                   vOffset, canvas);
                 break;
             }
             case 49: {
@@ -1612,8 +1613,8 @@
                 SkTDArray<uint8_t> text = make_fuzz_text(fuzz, paint);
                 SkPath path;
                 FuzzPath(fuzz, &path, 20);
-                canvas->drawTextOnPath(text.begin(), SkToSizeT(text.count()), path,
-                                       useMatrix ? &matrix : nullptr, paint);
+                SkDrawTextOnPath(text.begin(), SkToSizeT(text.count()), paint, path,
+                                 useMatrix ? &matrix :nullptr, canvas);
                 break;
             }
             case 50: {
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index 9608ddf..a514138 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -10,6 +10,7 @@
 #include "SkAutoMalloc.h"
 #include "SkCanvas.h"
 #include "SkRSXform.h"
+#include "SkTextOnPath.h"
 #include "SkSurface.h"
 #include "sk_tool_utils.h"
 
@@ -140,7 +141,7 @@
 
         canvas->drawTextRSXform(text, length, &xform[0], &bounds, paint);
     } else {
-        canvas->drawTextOnPathHV(text, length, path, 0, baseline_offset, paint);
+        SkDrawTextOnPathHV(text, length, paint, path, 0, baseline_offset, canvas);
     }
 
     if (true) {
diff --git a/gm/shadertext.cpp b/gm/shadertext.cpp
index 0158e9c..d2ddcd2 100644
--- a/gm/shadertext.cpp
+++ b/gm/shadertext.cpp
@@ -10,6 +10,7 @@
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkPath.h"
+#include "SkTextOnPath.h"
 
 namespace skiagm {
 
@@ -175,7 +176,7 @@
             ++i;
             canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth),
                               SkIntToScalar((i % testsPerCol) * rowHeight));
-            canvas->drawTextOnPath(text, textLen, path, nullptr, paint);
+            SkDrawTextOnPath(text, textLen, paint, path, nullptr, canvas);
             canvas->restore();
         }
         canvas->restore();
diff --git a/gm/shadertext2.cpp b/gm/shadertext2.cpp
index cce6699..20d7520 100644
--- a/gm/shadertext2.cpp
+++ b/gm/shadertext2.cpp
@@ -9,6 +9,7 @@
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkPath.h"
+#include "SkTextOnPath.h"
 
 static void makebm(SkBitmap* bm, int w, int h) {
     bm->allocN32Pixels(w, h);
@@ -158,8 +159,8 @@
 
                     canvas->save();
                         canvas->concat(matrices[m].fMatrix);
-                        canvas->drawTextOnPath(kText, kTextLen, path, nullptr, paint);
-                        canvas->drawTextOnPath(kText, kTextLen, path, nullptr, outlinePaint);
+                        SkDrawTextOnPath(kText, kTextLen, paint, path, nullptr, canvas);
+                        SkDrawTextOnPath(kText, kTextLen, outlinePaint, path, nullptr, canvas);
                     canvas->restore();
                     SkPaint stroke;
                     stroke.setStyle(SkPaint::kStroke_Style);
diff --git a/gn/samples.gni b/gn/samples.gni
index a02bf42..ed23f30 100644
--- a/gn/samples.gni
+++ b/gn/samples.gni
@@ -84,7 +84,6 @@
   "$_samplecode/SampleRegion.cpp",
   "$_samplecode/SampleRepeatTile.cpp",
   "$_samplecode/SampleShaders.cpp",
-  "$_samplecode/SampleShaderText.cpp",
   "$_samplecode/SampleShadowColor.cpp",
   "$_samplecode/SampleShadowReference.cpp",
   "$_samplecode/SampleShadowUtils.cpp",
@@ -99,7 +98,6 @@
   "$_samplecode/SampleTextAlpha.cpp",
   "$_samplecode/SampleTextBox.cpp",
   "$_samplecode/SampleTextEffects.cpp",
-  "$_samplecode/SampleTextOnPath.cpp",
   "$_samplecode/SampleTextureDomain.cpp",
   "$_samplecode/SampleTiling.cpp",
   "$_samplecode/SampleUnpremul.cpp",
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 8faf473..0522f2d 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1946,6 +1946,7 @@
     void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY,
                       const SkPaint& paint);
 
+#ifdef SK_SUPPORT_LEGACY_DRAWTEXTONPATH
     /** Deprecated.
     */
     void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& path, SkScalar hOffset,
@@ -1955,6 +1956,7 @@
     */
     void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
                         const SkMatrix* matrix, const SkPaint& paint);
+#endif
 
     /** Draws text, transforming each glyph by the corresponding SkRSXform,
         using clip, SkMatrix, and SkPaint paint.
@@ -2431,11 +2433,13 @@
     virtual void onDrawPosTextH(const void* text, size_t byteLength,
                                 const SkScalar xpos[], SkScalar constY,
                                 const SkPaint& paint);
+#ifdef SK_SUPPORT_LEGACY_DRAWTEXTONPATH
 #ifdef SK_SUPPORT_LEGACY_ONDRAWTEXTONPATH
     // DEPRECATED -- do not override
     virtual void onDrawTextOnPath(const void*, size_t, const SkPath&, const SkMatrix*,
                                   const SkPaint&) {}
 #endif
+#endif
     virtual void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
                                    const SkRect* cullRect, const SkPaint& paint);
     virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
diff --git a/include/utils/SkTextOnPath.h b/include/utils/SkTextOnPath.h
index 0d2e050..daeecd5 100644
--- a/include/utils/SkTextOnPath.h
+++ b/include/utils/SkTextOnPath.h
@@ -21,5 +21,8 @@
 void SkDrawTextOnPath(const void* text, size_t byteLength, const SkPaint& paint,
                       const SkPath& follow, const SkMatrix* matrix, SkCanvas* canvas);
 
+void SkDrawTextOnPathHV(const void* text, size_t byteLength, const SkPaint& paint,
+                        const SkPath& follow, SkScalar hOffset, SkScalar vOffset, SkCanvas* canvas);
+
 #endif
 
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index 787ad04..d34678f 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -28,6 +28,7 @@
 #include "SkPathMeasure.h"
 #include "SkPicture.h"
 #include "SkRandom.h"
+#include "SkTextOnPath.h"
 #include "SkTypeface.h"
 #include "SkUTF.h"
 
@@ -261,9 +262,9 @@
         paint.setColor(SK_ColorMAGENTA);
         paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
         matrix.setTranslate(SkIntToScalar(10), SkIntToScalar(10));
-        canvas->drawTextOnPath((void*) utf16, sizeof(utf16), path, &matrix, paint);
+        SkDrawTextOnPath((void*)utf16, sizeof(utf16), paint, path, &matrix, canvas);
         canvas->translate(0, SkIntToScalar(20));
-        canvas->drawTextOnPath((void*) utf16simple, sizeof(utf16simple), path, &matrix, paint);
+        SkDrawTextOnPath((void*) utf16simple, sizeof(utf16simple), paint, path, &matrix, canvas);
         canvas->restore();
 
         canvas->translate(0, SkIntToScalar(60));
diff --git a/samplecode/SampleShaderText.cpp b/samplecode/SampleShaderText.cpp
deleted file mode 100644
index 23eac1c..0000000
--- a/samplecode/SampleShaderText.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "Sample.h"
-#include "SkBitmap.h"
-#include "SkCanvas.h"
-#include "SkGradientShader.h"
-#include "SkPath.h"
-
-static void makebm(SkBitmap* bm, int w, int h) {
-    bm->allocN32Pixels(w, h);
-    bm->eraseColor(SK_ColorTRANSPARENT);
-
-    SkCanvas    canvas(*bm);
-    SkScalar s = SkIntToScalar(w < h ? w : h);
-    SkPoint     pts[] = { { 0, 0 }, { s, s } };
-    SkColor     colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
-    SkScalar    pos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
-    SkPaint     paint;
-
-    paint.setDither(true);
-    paint.setShader(SkGradientShader::MakeLinear(pts, colors, pos,
-                                    SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode));
-    canvas.drawPaint(paint);
-}
-
-static sk_sp<SkShader> MakeBitmapShader(SkShader::TileMode tx, SkShader::TileMode ty,
-                                        int w, int h) {
-    static SkBitmap bmp;
-    if (bmp.isNull()) {
-        makebm(&bmp, w/2, h/4);
-    }
-    return SkShader::MakeBitmapShader(bmp, tx, ty);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-struct GradData {
-    int             fCount;
-    const SkColor*  fColors;
-    const SkScalar* fPos;
-};
-
-static const SkColor gColors[] = {
-    SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK
-};
-
-static const GradData gGradData[] = {
-    { 2, gColors, nullptr },
-    { 5, gColors, nullptr },
-};
-
-static sk_sp<SkShader> MakeLinear(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
-    return SkGradientShader::MakeLinear(pts, data.fColors, data.fPos, data.fCount, tm);
-}
-
-static sk_sp<SkShader> MakeRadial(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
-    SkPoint center;
-    center.set(SkScalarAve(pts[0].fX, pts[1].fX),
-               SkScalarAve(pts[0].fY, pts[1].fY));
-    return SkGradientShader::MakeRadial(center, center.fX, data.fColors,
-                                        data.fPos, data.fCount, tm);
-}
-
-static sk_sp<SkShader> MakeSweep(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
-    SkPoint center;
-    center.set(SkScalarAve(pts[0].fX, pts[1].fX),
-               SkScalarAve(pts[0].fY, pts[1].fY));
-    return SkGradientShader::MakeSweep(center.fX, center.fY, data.fColors, data.fPos, data.fCount);
-}
-
-static sk_sp<SkShader> Make2Conical(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
-    SkPoint center0, center1;
-    center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
-                SkScalarAve(pts[0].fY, pts[1].fY));
-    center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
-                SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
-    return SkGradientShader::MakeTwoPointConical(
-                            center1, (pts[1].fX - pts[0].fX) / 7,
-                            center0, (pts[1].fX - pts[0].fX) / 2,
-                            data.fColors, data.fPos, data.fCount, tm);
-}
-
-typedef sk_sp<SkShader> (*GradMaker)(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm);
-
-static const GradMaker gGradMakers[] = {
-    MakeLinear, MakeRadial, MakeSweep, Make2Conical
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
-class ShaderTextView : public Sample {
-public:
-    ShaderTextView() {
-        this->setBGColor(0xFFDDDDDD);
-    }
-
-protected:
-    virtual bool onQuery(Sample::Event* evt) {
-        if (Sample::TitleQ(*evt)) {
-            Sample::TitleR(evt, "Shader Text");
-            return true;
-        }
-        return this->INHERITED::onQuery(evt);
-    }
-
-    virtual void onDrawContent(SkCanvas* canvas) {
-        const char text[] = "Shaded Text";
-        const int textLen = SK_ARRAY_COUNT(text) - 1;
-        static int pointSize = 36;
-
-        int w = pointSize * textLen;
-        int h = pointSize;
-
-        SkPoint pts[2] = {
-            { 0, 0 },
-            { SkIntToScalar(w), SkIntToScalar(h) }
-        };
-        SkScalar textBase = SkIntToScalar(h/2);
-
-        SkShader::TileMode tileModes[] = {
-            SkShader::kClamp_TileMode,
-            SkShader::kRepeat_TileMode,
-            SkShader::kMirror_TileMode
-        };
-
-        static const int gradCount = SK_ARRAY_COUNT(gGradData) *
-                                     SK_ARRAY_COUNT(gGradMakers);
-        static const int bmpCount = SK_ARRAY_COUNT(tileModes) *
-                                    SK_ARRAY_COUNT(tileModes);
-        sk_sp<SkShader> shaders[gradCount + bmpCount];
-
-        int shdIdx = 0;
-        for (size_t d = 0; d < SK_ARRAY_COUNT(gGradData); ++d) {
-            for (size_t m = 0; m < SK_ARRAY_COUNT(gGradMakers); ++m) {
-                shaders[shdIdx++] = gGradMakers[m](pts,
-                                                   gGradData[d],
-                                                   SkShader::kClamp_TileMode);
-            }
-        }
-        for (size_t tx = 0; tx < SK_ARRAY_COUNT(tileModes); ++tx) {
-            for (size_t ty = 0; ty < SK_ARRAY_COUNT(tileModes); ++ty) {
-                shaders[shdIdx++] = MakeBitmapShader(tileModes[tx],
-                                                     tileModes[ty],
-                                                     w/8, h);
-            }
-        }
-
-        SkPaint paint;
-        paint.setDither(true);
-        paint.setAntiAlias(true);
-        paint.setTextSize(SkIntToScalar(pointSize));
-
-        canvas->save();
-        canvas->translate(SkIntToScalar(20), SkIntToScalar(10));
-
-        SkPath path;
-        path.arcTo(SkRect::MakeXYWH(SkIntToScalar(-40), SkIntToScalar(15),
-                                    SkIntToScalar(300), SkIntToScalar(90)),
-                                    SkIntToScalar(225), SkIntToScalar(90),
-                                    false);
-        path.close();
-
-        static const int testsPerCol = 8;
-        static const int rowHeight = 60;
-        static const int colWidth = 300;
-        canvas->save();
-        for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); s++) {
-            canvas->save();
-            size_t i = 2*s;
-            canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth),
-                              SkIntToScalar((i % testsPerCol) * rowHeight));
-            paint.setShader(shaders[s]);
-            canvas->drawText(text, textLen, 0, textBase, paint);
-            canvas->restore();
-            canvas->save();
-            ++i;
-            canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth),
-                              SkIntToScalar((i % testsPerCol) * rowHeight));
-            canvas->drawTextOnPath(text, textLen, path, nullptr, paint);
-            canvas->restore();
-        }
-        canvas->restore();
-    }
-
-private:
-    typedef Sample INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
-DEF_SAMPLE( return new ShaderTextView(); )
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index e4f0b23..11d4279 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -12,6 +12,7 @@
 #include "SkWriteBuffer.h"
 #include "SkGradientShader.h"
 #include "SkPaint.h"
+#include "SkTextOnPath.h"
 #include "SkVertices.h"
 
 #include "sk_tool_utils.h"
@@ -261,14 +262,11 @@
 
     SkScalar x = 50;
     paint.setColor(0xFF008800);
-    canvas->drawTextOnPathHV(text, len, path,
-                             x, paint.getTextSize()*2/3, paint);
+    SkDrawTextOnPathHV(text, len, paint, path, x, paint.getTextSize()*2/3, canvas);
     paint.setColor(SK_ColorRED);
-    canvas->drawTextOnPathHV(text, len, path,
-                             x + 60, 0, paint);
+    SkDrawTextOnPathHV(text, len, paint, path, x + 60, 0, canvas);
     paint.setColor(SK_ColorBLUE);
-    canvas->drawTextOnPathHV(text, len, path,
-                             x + 120, -paint.getTextSize()*2/3, paint);
+    SkDrawTextOnPathHV(text, len, paint, path, x + 120, -paint.getTextSize()*2/3, canvas);
 
     path.offset(0, 200);
     paint.setTextAlign(SkPaint::kRight_Align);
@@ -284,21 +282,21 @@
     paint.setStyle(SkPaint::kFill_Style);
 
     paint.setTextSize(50);
-    canvas->drawTextOnPath(text, len, path, nullptr, paint);
+    SkDrawTextOnPath(text, len, paint, path, nullptr, canvas);
 
     paint.setColor(SK_ColorRED);
     matrix.setScale(-SK_Scalar1, SK_Scalar1);
     matrix.postTranslate(pathLen, 0);
-    canvas->drawTextOnPath(text, len, path, &matrix, paint);
+    SkDrawTextOnPath(text, len, paint, path, &matrix, canvas);
 
     paint.setColor(SK_ColorBLUE);
     matrix.setScale(SK_Scalar1, -SK_Scalar1);
-    canvas->drawTextOnPath(text, len, path, &matrix, paint);
+    SkDrawTextOnPath(text, len, paint, path, &matrix, canvas);
 
     paint.setColor(0xFF008800);
     matrix.setScale(-SK_Scalar1, -SK_Scalar1);
     matrix.postTranslate(pathLen, 0);
-    canvas->drawTextOnPath(text, len, path, &matrix, paint);
+    SkDrawTextOnPath(text, len, paint, path, &matrix, canvas);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/samplecode/SampleTextOnPath.cpp b/samplecode/SampleTextOnPath.cpp
deleted file mode 100644
index e222237..0000000
--- a/samplecode/SampleTextOnPath.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "Sample.h"
-#include "SkBlurMask.h"
-#include "SkBlurDrawLooper.h"
-#include "SkCanvas.h"
-#include "SkPath.h"
-#include "SkPathMeasure.h"
-
-#define REPEAT_COUNT    1
-
-static void textStrokePath(SkCanvas* canvas) {
-    SkPaint paint;
-    SkPath  path;
-    SkRect  rect;
-
-    canvas->save();
-    canvas->scale(SkIntToScalar(250),SkIntToScalar(250));
-
-    rect.set(0.0f,  0.21f,
-             0.78f, 0.99f);
-
-    path.addArc(rect, SkIntToScalar(280), SkIntToScalar(350));
-
-    paint.setAntiAlias(true);
-    paint.setStyle(SkPaint::kStroke_Style);
-    paint.setColor(0xFFFF0000);
-    paint.setTextSize(0.085f);
-    paint.setStrokeWidth(.005f);
-
-    canvas->drawPath(path, paint);
-
-    paint.setLooper(SkBlurDrawLooper::Make(SK_ColorBLACK, SkBlurMask::ConvertRadiusToSigma(0.002f),
-                                           0.0f, 0.0f));
-
-    const char* text = "DRAWING STROKED TEXT WITH A BLUR ON A PATH";
-    size_t      len = strlen(text);
-
-    canvas->drawTextOnPathHV(text, len, path, 0,
-                             -0.025f, paint);
-    canvas->restore();
-}
-
-static void textPathMatrix(SkCanvas* canvas) {
-    SkPaint paint;
-    SkPath  path;
-    SkMatrix matrix;
-
-    path.moveTo(SkIntToScalar(050), SkIntToScalar(200));
-    path.quadTo(SkIntToScalar(250), SkIntToScalar(000),
-                SkIntToScalar(450), SkIntToScalar(200));
-
-    paint.setAntiAlias(true);
-
-    paint.setStyle(SkPaint::kStroke_Style);
-    canvas->drawPath(path, paint);
-    paint.setStyle(SkPaint::kFill_Style);
-    paint.setTextSize(SkIntToScalar(48));
-    paint.setTextAlign(SkPaint::kRight_Align);
-
-    const char* text = "Reflection";
-    size_t      len = strlen(text);
-
-    SkPathMeasure   meas(path, false);
-    SkScalar pathLen = meas.getLength();
-
-    canvas->drawTextOnPath(text, len, path, nullptr, paint);
-
-    paint.setColor(SK_ColorRED);
-    matrix.setScale(-SK_Scalar1, SK_Scalar1);
-    matrix.postTranslate(pathLen, 0);
-    canvas->drawTextOnPath(text, len, path, &matrix, paint);
-
-    paint.setColor(SK_ColorBLUE);
-    matrix.setScale(SK_Scalar1, -SK_Scalar1);
-    canvas->drawTextOnPath(text, len, path, &matrix, paint);
-
-    paint.setColor(SK_ColorGREEN);
-    matrix.setScale(-SK_Scalar1, -SK_Scalar1);
-    matrix.postTranslate(pathLen, 0);
-    canvas->drawTextOnPath(text, len, path, &matrix, paint);
-}
-
-class TextOnPathView : public Sample {
-public:
-    SkPath      fPath;
-    SkScalar    fHOffset;
-
-protected:
-    void onOnceBeforeDraw() override {
-        SkRect r;
-        r.set(SkIntToScalar(100), SkIntToScalar(100),
-              SkIntToScalar(300), SkIntToScalar(300));
-        fPath.addOval(r);
-        fPath.offset(SkIntToScalar(-50), SkIntToScalar(-50));
-
-        fHOffset = SkIntToScalar(50);
-    }
-
-    bool onQuery(Sample::Event* evt) override {
-        if (Sample::TitleQ(*evt)) {
-            Sample::TitleR(evt, "Text On Path");
-            return true;
-        }
-        return this->INHERITED::onQuery(evt);
-    }
-
-    void onDrawContent(SkCanvas* canvas) override {
-        SkPaint paint;
-        paint.setAntiAlias(true);
-        paint.setTextSize(SkIntToScalar(48));
-
-        const char* text = "Hamburgefons";
-        size_t      len = strlen(text);
-
-        for (int j = 0; j < REPEAT_COUNT; j++) {
-            SkScalar x = fHOffset;
-
-            paint.setColor(SK_ColorBLACK);
-            canvas->drawTextOnPathHV(text, len, fPath,
-                                     x, paint.getTextSize()/2, paint);
-
-            paint.setColor(SK_ColorRED);
-            canvas->drawTextOnPathHV(text, len, fPath,
-                                     x + SkIntToScalar(50), 0, paint);
-
-            paint.setColor(SK_ColorBLUE);
-            canvas->drawTextOnPathHV(text, len, fPath,
-                         x + SkIntToScalar(100), -paint.getTextSize()/2, paint);
-        }
-
-        paint.setColor(SK_ColorGREEN);
-        paint.setStyle(SkPaint::kStroke_Style);
-        canvas->drawPath(fPath, paint);
-
-        canvas->translate(SkIntToScalar(275), 0);
-        textStrokePath(canvas);
-
-        canvas->translate(SkIntToScalar(-275), SkIntToScalar(250));
-        textPathMatrix(canvas);
-    }
-
-    Sample::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
-        fHints += 1;
-        return this->INHERITED::onFindClickHandler(x, y, modi);
-    }
-
-private:
-    int fHints;
-    typedef Sample INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-DEF_SAMPLE( return new TextOnPathView(); )
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 58348b9..3c66190 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2548,8 +2548,8 @@
     }
 }
 
+#ifdef SK_SUPPORT_LEGACY_DRAWTEXTONPATH
 #include "SkTextOnPath.h"
-
 void SkCanvas::drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
                               const SkMatrix* matrix, const SkPaint& paint) {
     TRACE_EVENT0("skia", TRACE_FUNC);
@@ -2559,6 +2559,16 @@
         SkDrawTextOnPath(text, byteLength, paint, path, matrix, this);
     }
 }
+void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength,
+                                const SkPath& path, SkScalar hOffset,
+                                SkScalar vOffset, const SkPaint& paint) {
+    SkMatrix    matrix;
+
+    matrix.setTranslate(hOffset, vOffset);
+    this->drawTextOnPath(text, byteLength, path, &matrix, paint);
+}
+#endif
+
 void SkCanvas::drawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
                                const SkRect* cullRect, const SkPaint& paint) {
     TRACE_EVENT0("skia", TRACE_FUNC);
@@ -2733,15 +2743,6 @@
     this->onDrawArc(oval, startAngle, sweepAngle, useCenter, paint);
 }
 
-void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength,
-                                const SkPath& path, SkScalar hOffset,
-                                SkScalar vOffset, const SkPaint& paint) {
-    SkMatrix    matrix;
-
-    matrix.setTranslate(hOffset, vOffset);
-    this->drawTextOnPath(text, byteLength, path, &matrix, paint);
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 /**
diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp
index d4e3901..38db669 100644
--- a/src/core/SkLiteDL.cpp
+++ b/src/core/SkLiteDL.cpp
@@ -54,7 +54,7 @@
     M(DrawRRect) M(DrawDRRect) M(DrawAnnotation) M(DrawDrawable) M(DrawPicture) \
     M(DrawImage) M(DrawImageNine) M(DrawImageRect) M(DrawImageLattice)          \
     M(DrawText) M(DrawPosText) M(DrawPosTextH)                                  \
-    M(DrawTextOnPath) M(DrawTextRSXform) M(DrawTextBlob)                        \
+    M(DrawTextRSXform) M(DrawTextBlob)                                          \
     M(DrawPatch) M(DrawPoints) M(DrawVertices) M(DrawAtlas) M(DrawShadowRec)
 
 #define M(T) T,
@@ -364,21 +364,6 @@
             c->drawPosTextH(text, bytes, xs, y, paint);
         }
     };
-    struct DrawTextOnPath final : Op {
-        static const auto kType = Type::DrawTextOnPath;
-        DrawTextOnPath(size_t bytes, const SkPath& path,
-                       const SkMatrix* matrix, const SkPaint& paint)
-            : bytes(bytes), path(path), paint(paint) {
-            if (matrix) { this->matrix = *matrix; }
-        }
-        size_t   bytes;
-        SkPath   path;
-        SkMatrix matrix = SkMatrix::I();
-        SkPaint  paint;
-        void draw(SkCanvas* c, const SkMatrix&) const {
-            c->drawTextOnPath(pod<void>(this), bytes, path, &matrix, paint);
-        }
-    };
     struct DrawTextRSXform final : Op {
         static const auto kType = Type::DrawTextRSXform;
         DrawTextRSXform(size_t bytes, int xforms, const SkRect* cull, const SkPaint& paint)
@@ -636,11 +621,6 @@
     void* pod = this->push<DrawPosTextH>(n*sizeof(SkScalar)+bytes, bytes, y, paint, n);
     copy_v(pod, xs,n, (const char*)text,bytes);
 }
-void SkLiteDL::drawTextOnPath(const void* text, size_t bytes,
-                              const SkPath& path, const SkMatrix* matrix, const SkPaint& paint) {
-    void* pod = this->push<DrawTextOnPath>(bytes, bytes, path, matrix, paint);
-    copy_v(pod, (const char*)text,bytes);
-}
 void SkLiteDL::drawTextRSXform(const void* text, size_t bytes,
                                const SkRSXform xforms[], const SkRect* cull, const SkPaint& paint) {
     int n = paint.countText(text, bytes);
diff --git a/src/core/SkLiteDL.h b/src/core/SkLiteDL.h
index ffcdb89..8c40f26 100644
--- a/src/core/SkLiteDL.h
+++ b/src/core/SkLiteDL.h
@@ -58,7 +58,6 @@
     void drawText       (const void*, size_t, SkScalar, SkScalar, const SkPaint&);
     void drawPosText    (const void*, size_t, const SkPoint[], const SkPaint&);
     void drawPosTextH   (const void*, size_t, const SkScalar[], SkScalar, const SkPaint&);
-    void drawTextOnPath (const void*, size_t, const SkPath&, const SkMatrix*, const SkPaint&);
     void drawTextRSXform(const void*, size_t, const SkRSXform[], const SkRect*, const SkPaint&);
     void drawTextBlob   (const SkTextBlob*, SkScalar,SkScalar, const SkPaint&);
 
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 0b78c1d..7516583 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -17,6 +17,7 @@
 #include "SkRSXform.h"
 #include "SkSafeMath.h"
 #include "SkTextBlob.h"
+#include "SkTextOnPath.h"
 #include "SkTDArray.h"
 #include "SkTypes.h"
 
@@ -592,7 +593,7 @@
             BREAK_ON_READ_ERROR(reader);
 
             if (paint && text.text()) {
-                canvas->drawTextOnPath(text.text(), text.length(), path, &matrix, *paint);
+                SkDrawTextOnPath(text.text(), text.length(), *paint, path, &matrix, canvas);
             }
         } break;
         case DRAW_TEXT_RSXFORM: {
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index e42ff29..26df05a 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -122,7 +122,6 @@
 DRAW(DrawRegion, drawRegion(r.region, r.paint));
 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint));
 DRAW(DrawTextBlob, drawTextBlob(r.blob.get(), r.x, r.y, r.paint));
-DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.paint));
 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r.paint));
 DRAW(DrawAtlas, drawAtlas(r.atlas.get(),
                           r.xforms, r.texs, r.colors, r.count, r.mode, r.cull, r.paint));
@@ -455,21 +454,6 @@
         AdjustTextForFontMetrics(&dst, op.paint);
         return this->adjustAndMap(dst, &op.paint);
     }
-    Bounds bounds(const DrawTextOnPath& op) const {
-        SkRect dst = op.path.getBounds();
-
-        // Pad all sides by the maximum padding in any direction we'd normally apply.
-        SkRect pad = { 0, 0, 0, 0};
-        AdjustTextForFontMetrics(&pad, op.paint);
-
-        // That maximum padding happens to always be the right pad today.
-        SkASSERT(pad.fLeft == -pad.fRight);
-        SkASSERT(pad.fTop  == -pad.fBottom);
-        SkASSERT(pad.fRight > pad.fBottom);
-        dst.outset(pad.fRight, pad.fRight);
-
-        return this->adjustAndMap(dst, &op.paint);
-    }
 
     Bounds bounds(const DrawTextRSXform& op) const {
         if (op.cull) {
diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h
index cce68c9..4a16983 100644
--- a/src/core/SkRecords.h
+++ b/src/core/SkRecords.h
@@ -74,7 +74,6 @@
     M(DrawPosText)                                                  \
     M(DrawPosTextH)                                                 \
     M(DrawText)                                                     \
-    M(DrawTextOnPath)                                               \
     M(DrawTextRSXform)                                              \
     M(DrawRRect)                                                    \
     M(DrawRect)                                                     \
@@ -314,12 +313,6 @@
         sk_sp<const SkTextBlob> blob;
         SkScalar x;
         SkScalar y);
-RECORD(DrawTextOnPath, kDraw_Tag|kHasText_Tag|kHasPaint_Tag,
-        SkPaint paint;
-        PODArray<char> text;
-        size_t byteLength;
-        PreCachedPath path;
-        TypedMatrix matrix);
 RECORD(DrawTextRSXform, kDraw_Tag|kHasText_Tag|kHasPaint_Tag,
         SkPaint paint;
         PODArray<char> text;
diff --git a/src/pipe/SkPipeFormat.h b/src/pipe/SkPipeFormat.h
index 13fdca5..2b49464 100644
--- a/src/pipe/SkPipeFormat.h
+++ b/src/pipe/SkPipeFormat.h
@@ -30,7 +30,6 @@
     kDrawPosText,       // extra == byteLength:24 else next 32
     kDrawPosTextH,      // extra == byteLength:24 else next 32
     kDrawRegion,        // extra == size:24 of region, or 0 means next 32
-    kDrawTextOnPath,
     kDrawTextBlob,
     kDrawTextRSXform,   // extra == (byteLength:23 << 1) else next 32 | has_cull_rect:1
     kDrawPatch,
@@ -181,12 +180,6 @@
 };
 
 enum {
-    kTextLength_DrawTextOnPathMask      = (1 << 16) - 1,
-    kMatrixType_DrawTextOnPathShift     = 16,
-    kMatrixType_DrawTextOnPathMask      = 0xF << kMatrixType_DrawTextOnPathShift,
-};
-
-enum {
     kHasPaint_DrawImageLatticeMask  = 1 << 0,
     kHasFlags_DrawImageLatticeMask  = 1 << 1,
     kXCount_DrawImageLatticeShift   = 2,        // bits  2:9  are xcount or FF means 32bits follow
diff --git a/src/pipe/SkPipeReader.cpp b/src/pipe/SkPipeReader.cpp
index 1d77779..78db581 100644
--- a/src/pipe/SkPipeReader.cpp
+++ b/src/pipe/SkPipeReader.cpp
@@ -379,27 +379,6 @@
     canvas->drawPosTextH(text, len, xpos, constY, paint);
 }
 
-static void drawTextOnPath_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas* canvas) {
-    SkASSERT(SkPipeVerb::kDrawTextOnPath == unpack_verb(packedVerb));
-    uint32_t byteLength = packedVerb & kTextLength_DrawTextOnPathMask;
-    SkMatrix::TypeMask tm = (SkMatrix::TypeMask)
-            ((packedVerb & kMatrixType_DrawTextOnPathMask) >> kMatrixType_DrawTextOnPathShift);
-
-    if (0 == byteLength) {
-        byteLength = reader.read32();
-    }
-    const void* text = reader.skip(SkAlign4(byteLength));
-    SkPath path;
-    reader.readPath(&path);
-    const SkMatrix* matrix = nullptr;
-    SkMatrix matrixStorage;
-    if (tm != SkMatrix::kIdentity_Mask) {
-        matrixStorage = read_sparse_matrix(reader, tm);
-        matrix = &matrixStorage;
-    }
-    canvas->drawTextOnPath(text, byteLength, path, matrix, read_paint(reader));
-}
-
 static void drawTextBlob_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas* canvas) {
     sk_sp<SkTextBlob> tb = SkTextBlobPriv::MakeFromBuffer(reader);
     SkScalar x = reader.readScalar();
@@ -741,7 +720,6 @@
     HANDLER(drawPosText),
     HANDLER(drawPosTextH),
     HANDLER(drawRegion),
-    HANDLER(drawTextOnPath),
     HANDLER(drawTextBlob),
     HANDLER(drawTextRSXform),
     HANDLER(drawPatch),
diff --git a/src/utils/SkTextOnPath.cpp b/src/utils/SkTextOnPath.cpp
index 3918ba4..3a8416ae 100644
--- a/src/utils/SkTextOnPath.cpp
+++ b/src/utils/SkTextOnPath.cpp
@@ -138,3 +138,8 @@
     });
 }
 
+void SkDrawTextOnPathHV(const void* text, size_t byteLength, const SkPaint& paint,
+                        const SkPath& follow, SkScalar h, SkScalar v, SkCanvas* canvas) {
+    SkMatrix matrix = SkMatrix::MakeTrans(h, v);
+    SkDrawTextOnPath(text, byteLength, paint, follow, &matrix, canvas);
+}
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 3370e76..af17791 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -432,8 +432,6 @@
     EXPECT_COPY_ON_WRITE(drawString(testText, 0, 1, testPaint))
     EXPECT_COPY_ON_WRITE(drawPosText(testText.c_str(), testText.size(), testPoints2, \
         testPaint))
-    EXPECT_COPY_ON_WRITE(drawTextOnPath(testText.c_str(), testText.size(), testPath, nullptr, \
-        testPaint))
 }
 DEF_TEST(SurfaceCopyOnWrite, reporter) {
     test_copy_on_write(reporter, create_surface().get());
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 7ad800f..27b34ef 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -241,7 +241,6 @@
         case kDrawShadow_OpType: return "DrawShadow";
         case kDrawText_OpType: return "DrawText";
         case kDrawTextBlob_OpType: return "DrawTextBlob";
-        case kDrawTextOnPath_OpType: return "DrawTextOnPath";
         case kDrawTextRSXform_OpType: return "DrawTextRSXform";
         case kDrawVertices_OpType: return "DrawVertices";
         case kDrawAtlas_OpType: return "DrawAtlas";
@@ -2141,33 +2140,6 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-SkDrawTextOnPathCommand::SkDrawTextOnPathCommand(const void* text, size_t byteLength,
-                                                 const SkPath& path, const SkMatrix* matrix,
-                                                 const SkPaint& paint)
-    : INHERITED(kDrawTextOnPath_OpType)
-    , fText(SkData::MakeWithCopy(text, byteLength))
-    , fPath(path)
-    , fMatrix(matrix)
-    , fPaint(paint) {}
-
-void SkDrawTextOnPathCommand::execute(SkCanvas* canvas) const {
-    canvas->drawTextOnPath(fText->data(), fText->size(), fPath, fMatrix.getMaybeNull(), fPaint);
-}
-
-Json::Value SkDrawTextOnPathCommand::toJSON(UrlDataManager& urlDataManager) const {
-    Json::Value result = INHERITED::toJSON(urlDataManager);
-    result[SKDEBUGCANVAS_ATTRIBUTE_TEXT] = make_json_text(fText);
-    Json::Value coords(Json::arrayValue);
-    result[SKDEBUGCANVAS_ATTRIBUTE_PATH] = MakeJsonPath(fPath);
-    if (fMatrix.isValid()) {
-        result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(*fMatrix.get());
-    }
-    result[SKDEBUGCANVAS_ATTRIBUTE_PAINT] = MakeJsonPaint(fPaint, urlDataManager);
-    return result;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
 SkDrawTextRSXformCommand::SkDrawTextRSXformCommand(const void* text, size_t byteLength,
                                                    const SkRSXform xform[], const SkRect* cull,
                                                    const SkPaint& paint)
diff --git a/tools/debugger/SkDrawCommand.h b/tools/debugger/SkDrawCommand.h
index 76d5f06..2acc504 100644
--- a/tools/debugger/SkDrawCommand.h
+++ b/tools/debugger/SkDrawCommand.h
@@ -57,7 +57,6 @@
         kDrawShadow_OpType,
         kDrawText_OpType,
         kDrawTextBlob_OpType,
-        kDrawTextOnPath_OpType,
         kDrawTextRSXform_OpType,
         kDrawVertices_OpType,
         kDrawAtlas_OpType,
@@ -513,22 +512,6 @@
     typedef SkDrawCommand INHERITED;
 };
 
-class SkDrawTextOnPathCommand : public SkDrawCommand {
-public:
-    SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& path,
-                            const SkMatrix* matrix, const SkPaint& paint);
-    void execute(SkCanvas* canvas) const override;
-    Json::Value toJSON(UrlDataManager& urlDataManager) const override;
-
-private:
-    sk_sp<SkData>     fText;
-    SkPath            fPath;
-    SkTLazy<SkMatrix> fMatrix;
-    SkPaint           fPaint;
-
-    typedef SkDrawCommand INHERITED;
-};
-
 class SkDrawTextRSXformCommand : public SkDrawCommand {
 public:
     SkDrawTextRSXformCommand(const void* text, size_t byteLength, const SkRSXform[],