remove unused SkMeshUtils and SkBoundaryPatch

BUG=skia:6366

Change-Id: Ibacd397e0a246dbeefde074c98712ada3848a7b6
Reviewed-on: https://skia-review.googlesource.com/9852
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/gn/utils.gni b/gn/utils.gni
index 4a3841b..807ae58 100644
--- a/gn/utils.gni
+++ b/gn/utils.gni
@@ -8,14 +8,12 @@
 _include = get_path_info("../include", "abspath")
 
 skia_utils_sources = [
-  "$_include/utils/SkBoundaryPatch.h",
   "$_include/utils/SkFrontBufferedStream.h",
   "$_include/utils/SkCamera.h",
   "$_include/utils/SkCanvasStateUtils.h",
   "$_include/utils/SkDumpCanvas.h",
   "$_include/utils/SkEventTracer.h",
   "$_include/utils/SkInterpolator.h",
-  "$_include/utils/SkMeshUtils.h",
   "$_include/utils/SkNoDrawCanvas.h",
   "$_include/utils/SkNWayCanvas.h",
   "$_include/utils/SkNullCanvas.h",
@@ -31,7 +29,6 @@
   "$_src/utils/SkBitmapSourceDeserializer.cpp",
   "$_src/utils/SkBitmapSourceDeserializer.h",
   "$_src/utils/SkBitSet.h",
-  "$_src/utils/SkBoundaryPatch.cpp",
   "$_src/utils/SkFrontBufferedStream.cpp",
   "$_src/utils/SkCamera.cpp",
   "$_src/utils/SkCanvasStack.h",
@@ -48,7 +45,6 @@
   "$_src/utils/SkInterpolator.cpp",
   "$_src/utils/SkMatrix22.cpp",
   "$_src/utils/SkMatrix22.h",
-  "$_src/utils/SkMeshUtils.cpp",
   "$_src/utils/SkMultiPictureDocument.cpp",
   "$_src/utils/SkNWayCanvas.cpp",
   "$_src/utils/SkNullCanvas.cpp",
diff --git a/include/utils/SkBoundaryPatch.h b/include/utils/SkBoundaryPatch.h
deleted file mode 100644
index f8edd59..0000000
--- a/include/utils/SkBoundaryPatch.h
+++ /dev/null
@@ -1,66 +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.
- */
-#ifndef SkBoundaryPatch_DEFINED
-#define SkBoundaryPatch_DEFINED
-
-#include "SkPoint.h"
-#include "SkRefCnt.h"
-
-class SkBoundary : public SkRefCnt {
-public:
-    
-
-    // These must be 0, 1, 2, 3 for efficiency in the subclass implementations
-    enum Edge {
-        kTop    = 0,
-        kRight  = 1,
-        kBottom = 2,
-        kLeft   = 3
-    };
-    // Edge index goes clockwise around the boundary, beginning at the "top"
-    virtual SkPoint eval(Edge, SkScalar unitInterval) = 0;
-
-private:
-    typedef SkRefCnt INHERITED;
-};
-
-class SkBoundaryPatch {
-public:
-    SkBoundaryPatch();
-    ~SkBoundaryPatch();
-
-    SkBoundary* getBoundary() const { return fBoundary; }
-    SkBoundary* setBoundary(SkBoundary*);
-
-    SkPoint eval(SkScalar unitU, SkScalar unitV);
-    bool evalPatch(SkPoint verts[], int rows, int cols);
-
-private:
-    SkBoundary* fBoundary;
-};
-
-////////////////////////////////////////////////////////////////////////
-
-class SkLineBoundary : public SkBoundary {
-public:
-    SkPoint fPts[4];
-
-    // override
-    virtual SkPoint eval(Edge, SkScalar);
-};
-
-class SkCubicBoundary : public SkBoundary {
-public:
-    // the caller sets the first 12 entries. The 13th is used by the impl.
-    SkPoint fPts[13];
-
-    // override
-    virtual SkPoint eval(Edge, SkScalar);
-};
-
-#endif
diff --git a/include/utils/SkMeshUtils.h b/include/utils/SkMeshUtils.h
deleted file mode 100644
index 7e0e8f4..0000000
--- a/include/utils/SkMeshUtils.h
+++ /dev/null
@@ -1,50 +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.
- */
-#ifndef SkMeshUtils_DEFINED
-#define SkMeshUtils_DEFINED
-
-#include "SkPoint.h"
-#include "SkColor.h"
-
-class SkBitmap;
-class SkCanvas;
-class SkPaint;
-
-class SkMeshIndices {
-public:
-    SkMeshIndices();
-    ~SkMeshIndices();
-
-    bool init(int texW, int texH, int rows, int cols) {
-        return this->init(NULL, NULL, texW, texH, rows, cols);
-    }
-
-    bool init(SkPoint tex[], uint16_t indices[],
-              int texW, int texH, int rows, int cols);
-
-    int             indexCount() const { return fIndexCount; }
-    const uint16_t* indices() const { return fIndices; }
-
-    size_t          texCount() const { return fTexCount; }
-    const SkPoint*  tex() const { return fTex; }
-
-private:
-    int         fIndexCount, fTexCount;
-    SkPoint*    fTex;
-    uint16_t*   fIndices;
-    void*       fStorage; // may be null
-};
-
-class SkMeshUtils {
-public:
-    static void Draw(SkCanvas*, const SkBitmap&, int rows, int cols,
-                     const SkPoint verts[], const SkColor colors[],
-                     const SkPaint& paint);
-};
-
-#endif
diff --git a/src/utils/SkBoundaryPatch.cpp b/src/utils/SkBoundaryPatch.cpp
deleted file mode 100644
index 0cfb09c..0000000
--- a/src/utils/SkBoundaryPatch.cpp
+++ /dev/null
@@ -1,78 +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 "SkBoundaryPatch.h"
-
-SkBoundaryPatch::SkBoundaryPatch() : fBoundary(nullptr) {}
-
-SkBoundaryPatch::~SkBoundaryPatch() {
-    SkSafeUnref(fBoundary);
-}
-
-SkBoundary* SkBoundaryPatch::setBoundary(SkBoundary* b) {
-    SkRefCnt_SafeAssign(fBoundary, b);
-    return b;
-}
-
-static SkPoint SkMakePoint(SkScalar x, SkScalar y) {
-    SkPoint pt;
-    pt.set(x, y);
-    return pt;
-}
-
-static SkPoint SkPointInterp(const SkPoint& a, const SkPoint& b, SkScalar t) {
-    return SkMakePoint(SkScalarInterp(a.fX, b.fX, t),
-                       SkScalarInterp(a.fY, b.fY, t));
-}
-
-SkPoint SkBoundaryPatch::eval(SkScalar unitU, SkScalar unitV) {
-    SkBoundary* b = fBoundary;
-    SkPoint u = SkPointInterp(b->eval(SkBoundary::kLeft, SK_Scalar1 - unitV),
-                              b->eval(SkBoundary::kRight, unitV),
-                              unitU);
-    SkPoint v = SkPointInterp(b->eval(SkBoundary::kTop, unitU),
-                              b->eval(SkBoundary::kBottom, SK_Scalar1 - unitU),
-                              unitV);
-    return SkMakePoint(SkScalarAve(u.fX, v.fX),
-                       SkScalarAve(u.fY, v.fY));
-}
-
-bool SkBoundaryPatch::evalPatch(SkPoint verts[], int rows, int cols) {
-    if (rows < 2 || cols < 2) {
-        return false;
-    }
-
-    const SkScalar invR = SkScalarInvert(SkIntToScalar(rows - 1));
-    const SkScalar invC = SkScalarInvert(SkIntToScalar(cols - 1));
-
-    for (int y = 0; y < cols; y++) {
-        SkScalar yy = y * invC;
-        for (int x = 0; x < rows; x++) {
-            *verts++ = this->eval(x * invR, yy);
-        }
-    }
-    return true;
-}
-
-////////////////////////////////////////////////////////////////////////
-
-#include "SkGeometry.h"
-
-SkPoint SkLineBoundary::eval(Edge e, SkScalar t) {
-    SkASSERT((unsigned)e < 4);
-    return SkPointInterp(fPts[e], fPts[(e + 1) & 3], t);
-}
-
-SkPoint SkCubicBoundary::eval(Edge e, SkScalar t) {
-    SkASSERT((unsigned)e < 4);
-
-    // ensure our 4th cubic wraps to the start of the first
-    fPts[12] = fPts[0];
-
-    SkPoint loc;
-    SkEvalCubicAt(&fPts[e * 3], t, &loc, nullptr, nullptr);
-    return loc;
-}
diff --git a/src/utils/SkMeshUtils.cpp b/src/utils/SkMeshUtils.cpp
deleted file mode 100644
index 4c9c0d0..0000000
--- a/src/utils/SkMeshUtils.cpp
+++ /dev/null
@@ -1,101 +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 "SkMeshUtils.h"
-#include "SkCanvas.h"
-#include "SkPaint.h"
-
-SkMeshIndices::SkMeshIndices() {
-    sk_bzero(this, sizeof(*this));
-}
-
-SkMeshIndices::~SkMeshIndices() {
-    sk_free(fStorage);
-}
-
-bool SkMeshIndices::init(SkPoint tex[], uint16_t indices[],
-                         int texW, int texH, int rows, int cols) {
-    if (rows < 2 || cols < 2) {
-        sk_free(fStorage);
-        fStorage = nullptr;
-        fTex = nullptr;
-        fIndices = nullptr;
-        fTexCount = fIndexCount = 0;
-        return false;
-    }
-
-    sk_free(fStorage);
-    fStorage = nullptr;
-
-    fTexCount = rows * cols;
-    rows -= 1;
-    cols -= 1;
-    fIndexCount = rows * cols * 6;
-
-    if (tex) {
-        fTex = tex;
-        fIndices = indices;
-    } else {
-        fStorage = sk_malloc_throw(fTexCount * sizeof(SkPoint) +
-                                   fIndexCount * sizeof(uint16_t));
-        fTex = (SkPoint*)fStorage;
-        fIndices = (uint16_t*)(fTex + fTexCount);
-    }
-
-    // compute the indices
-    {
-        uint16_t* idx = fIndices;
-        int index = 0;
-        for (int y = 0; y < cols; y++) {
-            for (int x = 0; x < rows; x++) {
-                *idx++ = index;
-                *idx++ = index + rows + 1;
-                *idx++ = index + 1;
-
-                *idx++ = index + 1;
-                *idx++ = index + rows + 1;
-                *idx++ = index + rows + 2;
-
-                index += 1;
-            }
-            index += 1;
-        }
-    }
-
-    // compute texture coordinates
-    {
-        SkPoint* tex = fTex;
-        const SkScalar dx = SkIntToScalar(texW) / rows;
-        const SkScalar dy = SkIntToScalar(texH) / cols;
-        for (int y = 0; y <= cols; y++) {
-            for (int x = 0; x <= rows; x++) {
-                tex->set(x*dx, y*dy);
-                tex += 1;
-            }
-        }
-    }
-    return true;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-#include "SkShader.h"
-
-void SkMeshUtils::Draw(SkCanvas* canvas, const SkBitmap& bitmap,
-                       int rows, int cols, const SkPoint verts[],
-                       const SkColor colors[], const SkPaint& paint) {
-    SkMeshIndices idx;
-
-    if (idx.init(bitmap.width(), bitmap.height(), rows, cols)) {
-        SkPaint p(paint);
-        p.setShader(SkShader::MakeBitmapShader(bitmap,
-                                         SkShader::kClamp_TileMode,
-                                         SkShader::kClamp_TileMode));
-        canvas->drawVertices(SkCanvas::kTriangles_VertexMode,
-                             rows * cols, verts, idx.tex(), colors, SkBlendMode::kModulate,
-                             idx.indices(), idx.indexCount(), p);
-    }
-}