Generate Android build targets for dm and nanobench

Generate targets for dm and nanobench from ninja and add them to the
generated Android.bp file.

Remove nanobenchAndroid and SkAndroidSDKCanvas. These rely on HWUI
internals and are currently unused.

Update gyp file references to removed files, just in case.

Change-Id: Ic6ae18a70bfd0c33804e7996d077f2081dfdfe07
Reviewed-on: https://skia-review.googlesource.com/7635
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/bench/ColorCubeBench.cpp b/bench/ColorCubeBench.cpp
deleted file mode 100644
index e34d971..0000000
--- a/bench/ColorCubeBench.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// Temporary.  When gn_to_bp.py works for nanobench, we can remove this.
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 6aea7b5..887fab3 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -53,10 +53,6 @@
     #include <unistd.h>
 #endif
 
-#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
-    #include "nanobenchAndroid.h"
-#endif
-
 #if SK_SUPPORT_GPU
     #include "gl/GrGLDefines.h"
     #include "GrCaps.h"
@@ -468,15 +464,6 @@
     }
 
     #undef CPU_CONFIG
-
-#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
-    if (config->getTag().equals("hwui")) {
-        Config config = { SkString("hwui"), Benchmark::kHWUI_Backend,
-                          kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr,
-                          0, kBogusContextType, kBogusContextOptions, false };
-        configs->push_back(config);
-    }
-#endif
 }
 
 // Append all configs that are enabled and supported.
@@ -511,11 +498,6 @@
         target = new GPUTarget(config);
         break;
 #endif
-#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
-    case Benchmark::kHWUI_Backend:
-        target = new HWUITarget(config, bench);
-        break;
-#endif
     default:
         target = new Target(config);
         break;
diff --git a/bench/nanobenchAndroid.cpp b/bench/nanobenchAndroid.cpp
deleted file mode 100644
index cb6f09d..0000000
--- a/bench/nanobenchAndroid.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "nanobenchAndroid.h"
-
-/* These functions are only compiled in the Android Framework. */
-
-HWUITarget::HWUITarget(const Config& c, Benchmark* bench) : Target(c) { }
-
-void HWUITarget::setup() {
-    this->renderer.fence();
-}
-
-SkCanvas* HWUITarget::beginTiming(SkCanvas* canvas) {
-    SkCanvas* targetCanvas = this->renderer.prepareToDraw();
-    if (targetCanvas) {
-        this->fc.reset(targetCanvas);
-        canvas = &this->fc;
-        // This might minimally distort timing, but canvas isn't valid outside the timer.
-        canvas->clear(SK_ColorWHITE);
-    }
-
-    return canvas;
-}
-
-void HWUITarget::endTiming() {
-    this->renderer.finishDrawing();
-}
-
-void HWUITarget::fence() {
-    this->renderer.fence();
-}
-
-bool HWUITarget::needsFrameTiming(int* frameLag) const {
-    extern int FLAGS_gpuFrameLag;
-    *frameLag = FLAGS_gpuFrameLag;
-    return true;
-}
-
-bool HWUITarget::init(SkImageInfo info, Benchmark* bench) {
-    this->renderer.initialize(bench->getSize().x(), bench->getSize().y());
-    return true;
-}
-
-bool HWUITarget::capturePixels(SkBitmap* bmp) {
-    return this->renderer.capturePixels(bmp);
-}
diff --git a/bench/nanobenchAndroid.h b/bench/nanobenchAndroid.h
deleted file mode 100644
index ef28751..0000000
--- a/bench/nanobenchAndroid.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef nanobenchAndroid_DEFINED
-#define nanobenchAndroid_DEFINED
-
-#include "SkAndroidSDKCanvas.h"
-#include <utils/TestWindowContext.h>
-
-#include "nanobench.h"
-
-struct HWUITarget : public Target {
-    explicit HWUITarget(const Config& c, Benchmark* bench);
-
-    android::uirenderer::TestWindowContext renderer;
-    SkAndroidSDKCanvas fc;
-
-    void setup() override;
-    SkCanvas* beginTiming(SkCanvas* canvas) override;
-    void endTiming() override;
-    void fence() override;
-    bool needsFrameTiming(int* frameLag) const override;
-
-    bool init(SkImageInfo info, Benchmark* bench) override;
-    bool capturePixels(SkBitmap* bmp) override;
-};
-
-#endif  // nanobenchAndroid_DEFINED
diff --git a/gm/colorcube.cpp b/gm/colorcube.cpp
deleted file mode 100644
index 84ebc43..0000000
--- a/gm/colorcube.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// Temporary.  When gn_to_bp.py works for DM, we can remove this.
diff --git a/gm/gammacolorfilter.cpp b/gm/gammacolorfilter.cpp
deleted file mode 100644
index 84ebc43..0000000
--- a/gm/gammacolorfilter.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// Temporary.  When gn_to_bp.py works for DM, we can remove this.
diff --git a/gn/gn_to_bp.py b/gn/gn_to_bp.py
index 5173246..e0605c9 100644
--- a/gn/gn_to_bp.py
+++ b/gn/gn_to_bp.py
@@ -14,6 +14,36 @@
 import subprocess
 import tempfile
 
+tool_cflags = [
+    '-Wno-unused-parameter',
+]
+
+# It's easier to maintain one list instead of separate lists.
+tool_shared_libs = [
+    'liblog',
+    'libGLESv2',
+    'libEGL',
+    'libvulkan',
+    'libz',
+    'libjpeg',
+    'libpng',
+    'libicuuc',
+    'libicui18n',
+    'libexpat',
+    'libft2',
+    'libdng_sdk',
+    'libpiex',
+]
+
+# The ordering here is important: libsfntly needs to come after libskia.
+tool_static_libs = [
+    'libjsoncpp',
+    'libskia',
+    'libsfntly',
+    'libwebp-decode',
+    'libwebp-encode',
+]
+
 # First we start off with a template for Android.bp,
 # with holes for source lists and include directories.
 bp = string.Template('''// This file is autogenerated by gn_to_bp.py.
@@ -104,6 +134,54 @@
         "libwebp-decode",
         "libwebp-encode",
     ],
+}
+
+cc_test {
+    name: "skia_dm",
+
+    cflags: [
+        $tool_cflags
+    ],
+
+    local_include_dirs: [
+        $dm_includes
+    ],
+
+    srcs: [
+        $dm_srcs
+    ],
+
+    shared_libs: [
+        $tool_shared_libs
+    ],
+
+    static_libs: [
+        $tool_static_libs
+    ],
+}
+
+cc_test {
+    name: "skia_nanobench",
+
+    cflags: [
+        $tool_cflags
+    ],
+
+    local_include_dirs: [
+        $nanobench_includes
+    ],
+
+    srcs: [
+        $nanobench_srcs
+    ],
+
+    shared_libs: [
+        $tool_shared_libs
+    ],
+
+    static_libs: [
+        $tool_static_libs
+    ],
 }''')
 
 # We'll run GN to get the main source lists and include directories for Skia.
@@ -111,6 +189,9 @@
   'skia_enable_splicer':             'false',
   'skia_enable_vulkan_debug_layers': 'false',
   'skia_use_system_expat':           'true',
+  'skia_use_system_jsoncpp':         'true',
+  'skia_use_system_libpng':          'true',
+  'skia_use_system_zlib':            'true',
   'skia_use_vulkan':                 'true',
   'target_cpu':                      '"none"',
   'target_os':                       '"android"',
@@ -129,16 +210,33 @@
 local_includes  = strip_slashes(js['targets']['//:skia']['include_dirs'])
 export_includes = strip_slashes(js['targets']['//:public']['include_dirs'])
 
-# Grab the sources from targets :skia depends on (optional Skia components).
-for dep in js['targets']['//:skia']['deps']:
-  if 'third_party' in dep:
-    continue   # We've handled all third-party DEPS as static or shared_libs.
-  if 'none' in dep:
-    continue   # We'll handle all cpu-specific sources manually later.
-  srcs.extend(strip_slashes(js['targets'][dep].get('sources', [])))
+dm_srcs         = strip_slashes(js['targets']['//:dm']['sources'])
+dm_includes     = strip_slashes(js['targets']['//:dm']['include_dirs'])
+
+nanobench_target = js['targets']['//:nanobench']
+nanobench_srcs     = strip_slashes(nanobench_target['sources'])
+nanobench_includes = strip_slashes(nanobench_target['include_dirs'])
+
+def GrabDependentSrcs(name, srcs_to_extend, exclude):
+  # Grab the sources from other targets that $name depends on (e.g. optional
+  # Skia components, gms, tests, etc).
+  for dep in js['targets'][name]['deps']:
+    if 'third_party' in dep:
+      continue   # We've handled all third-party DEPS as static or shared_libs.
+    if 'none' in dep:
+      continue   # We'll handle all cpu-specific sources manually later.
+    if exclude and exclude in dep:
+      continue
+    srcs_to_extend.extend(strip_slashes(js['targets'][dep].get('sources', [])))
+
+GrabDependentSrcs('//:skia', srcs, None)
+GrabDependentSrcs('//:dm', dm_srcs, 'skia')
+GrabDependentSrcs('//:nanobench', nanobench_srcs, 'skia')
 
 # No need to list headers.
-srcs = [s for s in srcs if not s.endswith('.h')]
+srcs            = [s for s in srcs           if not s.endswith('.h')]
+dm_srcs         = [s for s in dm_srcs        if not s.endswith('.h')]
+nanobench_srcs  = [s for s in nanobench_srcs if not s.endswith('.h')]
 
 # Most defines go into SkUserConfig.h, where they're seen by Skia and its users.
 # Start with the defines :skia uses, minus a couple.  We'll add more in a bit.
@@ -186,8 +284,10 @@
   return [os.path.relpath(p, '..') for p in lst]
 
 # Turn a list of strings into the style bpfmt outputs.
-def bpfmt(indent, lst):
-  return ('\n' + ' '*indent).join('"%s",' % v for v in sorted(lst))
+def bpfmt(indent, lst, sort=True):
+  if sort:
+    lst = sorted(lst)
+  return ('\n' + ' '*indent).join('"%s",' % v for v in lst)
 
 # OK!  We have everything to fill in Android.bp...
 with open('Android.bp', 'w') as f:
@@ -206,7 +306,17 @@
                                      defs['sse41'] +
                                      defs['sse42'] +
                                      defs['avx'  ] +
-                                     defs['hsw'  ]))
+                                     defs['hsw'  ])),
+
+    'tool_cflags'       : bpfmt(8, tool_cflags),
+    'tool_shared_libs'  : bpfmt(8, tool_shared_libs),
+    'tool_static_libs'  : bpfmt(8, tool_static_libs, False),
+
+    'dm_includes'       : bpfmt(8, dm_includes),
+    'dm_srcs'           : bpfmt(8, dm_srcs),
+
+    'nanobench_includes'    : bpfmt(8, nanobench_includes),
+    'nanobench_srcs'        : bpfmt(8, nanobench_srcs),
   })
 
 #... and all the #defines we want to put in SkUserConfig.h.
diff --git a/gyp/bench.gypi b/gyp/bench.gypi
index ded8ff4..4014c47 100644
--- a/gyp/bench.gypi
+++ b/gyp/bench.gypi
@@ -29,8 +29,5 @@
       'include_dirs': [ '../src/gpu' ],
       'dependencies': [ 'gputest.gyp:skgputest' ],
     }],
-    ['not skia_android_framework', {
-        'sources!': [ '../bench/nanobenchAndroid.cpp' ],
-    }],
   ],
 }
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index b94f037..969a6b4 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -59,22 +59,6 @@
       ],
     },
     {
-      'target_name': 'android_utils',
-      'type': 'static_library',
-      'dependencies': [
-        'core.gyp:core',
-      ],
-      'sources': [
-        '../tools/android/SkAndroidSDKCanvas.h',
-        '../tools/android/SkAndroidSDKCanvas.cpp',
-      ],
-      'direct_dependent_settings': {
-        'include_dirs': [
-          '../tools/android',
-        ],
-      },
-    },
-    {
         'target_name': 'dump_record',
         'type': 'executable',
         'sources': [
diff --git a/tests/FixedAllocTest.cpp b/tests/FixedAllocTest.cpp
deleted file mode 100644
index 2c95e62..0000000
--- a/tests/FixedAllocTest.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// Temporary.  When gn_to_bp.py works for DM, we can remove this.
diff --git a/third_party/jsoncpp/BUILD.gn b/third_party/jsoncpp/BUILD.gn
index 4122692..34150c0 100644
--- a/third_party/jsoncpp/BUILD.gn
+++ b/third_party/jsoncpp/BUILD.gn
@@ -4,18 +4,25 @@
 # found in the LICENSE file.
 
 declare_args() {
+  skia_use_system_jsoncpp = false
 }
 
 import("../third_party.gni")
 
-third_party("jsoncpp") {
-  public_include_dirs = [ "../externals/jsoncpp/include" ]
+if (skia_use_system_jsoncpp) {
+  system("jsoncpp") {
+    libs = [ "jsoncpp" ]
+  }
+} else {
+  third_party("jsoncpp") {
+    public_include_dirs = [ "../externals/jsoncpp/include" ]
 
-  defines = [ "JSON_USE_EXCEPTION=0" ]
-  sources = [
-    "../externals/jsoncpp/src/lib_json/json_reader.cpp",
-    "../externals/jsoncpp/src/lib_json/json_value.cpp",
-    "../externals/jsoncpp/src/lib_json/json_writer.cpp",
-  ]
-  testonly = true
+    defines = [ "JSON_USE_EXCEPTION=0" ]
+    sources = [
+      "../externals/jsoncpp/src/lib_json/json_reader.cpp",
+      "../externals/jsoncpp/src/lib_json/json_value.cpp",
+      "../externals/jsoncpp/src/lib_json/json_writer.cpp",
+    ]
+    testonly = true
+  }
 }
diff --git a/tools/android/SkAndroidSDKCanvas.cpp b/tools/android/SkAndroidSDKCanvas.cpp
deleted file mode 100644
index 6f5aaf1..0000000
--- a/tools/android/SkAndroidSDKCanvas.cpp
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkAndroidSDKCanvas.h"
-
-#include "SkColorFilter.h"
-#include "SkDrawLooper.h"
-#include "SkImageFilter.h"
-#include "SkPaint.h"
-#include "SkPathEffect.h"
-#include "SkShader.h"
-#include "SkSurface.h"
-#include "SkTLazy.h"
-
-namespace {
-
-/** Discard SkShaders not exposed by the Android Java API. */
-
-void CheckShader(SkPaint* paint) {
-    SkShader* shader = paint->getShader();
-    if (!shader) {
-        return;
-    }
-
-    if (shader->isAImage()) {
-        return;
-    }
-    if (shader->asACompose(nullptr)) {
-        return;
-    }
-    SkShader::GradientType gtype = shader->asAGradient(nullptr);
-    if (gtype == SkShader::kLinear_GradientType ||
-        gtype == SkShader::kRadial_GradientType ||
-        gtype == SkShader::kSweep_GradientType) {
-        return;
-    }
-    paint->setShader(nullptr);
-}
-
-void Filter(SkPaint* paint) {
-
-    uint32_t flags = paint->getFlags();
-    flags &= ~SkPaint::kLCDRenderText_Flag;
-    paint->setFlags(flags);
-
-    // Android doesn't support blend modes above kLighten_Mode
-    if (paint->getBlendMode() > SkBlendMode::kLighten) {
-        paint->setBlendMode(SkBlendMode::kSrcOver);
-    }
-
-    // Force bilinear scaling or none
-    if (paint->getFilterQuality() != kNone_SkFilterQuality) {
-        paint->setFilterQuality(kLow_SkFilterQuality);
-    }
-
-    CheckShader(paint);
-
-    // Android SDK only supports mode & matrix color filters
-    // (and, again, no modes above kLighten_Mode).
-    SkColorFilter* cf = paint->getColorFilter();
-    if (cf) {
-        SkColor color;
-        SkBlendMode mode;
-        SkScalar srcColorMatrix[20];
-        bool isMode = cf->asColorMode(&color, &mode);
-        if (isMode && (int)mode > (int)SkBlendMode::kLighten) {
-            paint->setColorFilter(
-                SkColorFilter::MakeModeFilter(color, SkBlendMode::kSrcOver));
-        } else if (!isMode && !cf->asColorMatrix(srcColorMatrix)) {
-            paint->setColorFilter(nullptr);
-        }
-    }
-
-#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
-    SkPathEffect* pe = paint->getPathEffect();
-    if (pe && !pe->exposedInAndroidJavaAPI()) {
-        paint->setPathEffect(nullptr);
-    }
-#endif
-
-    // TODO: Android doesn't support all the flags that can be passed to
-    // blur filters; we need plumbing to get them out.
-
-    paint->setImageFilter(nullptr);
-    paint->setLooper(nullptr);
-};
-
-}  // namespace
-
-#define FILTER(p)             \
-    SkPaint filteredPaint(p); \
-    Filter(&filteredPaint);
-
-#define FILTER_PTR(p)                          \
-    SkTLazy<SkPaint> lazyPaint;                \
-    SkPaint* filteredPaint = (SkPaint*) p;     \
-    if (p) {                                   \
-        filteredPaint = lazyPaint.set(*p);     \
-        Filter(filteredPaint);                 \
-    }
-
-
-SkAndroidSDKCanvas::SkAndroidSDKCanvas() : fProxyTarget(nullptr) { }
-
-void SkAndroidSDKCanvas::reset(SkCanvas* newTarget) { fProxyTarget = newTarget; }
-
-void SkAndroidSDKCanvas::onDrawPaint(const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawPaint(filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawPoints(PointMode pMode,
-                                               size_t count,
-                                               const SkPoint pts[],
-                                               const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawPoints(pMode, count, pts, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawOval(const SkRect& r, const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawOval(r, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawArc(const SkRect& r, SkScalar startAngle, SkScalar sweepAngle,
-                                   bool useCenter, const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawArc(r, startAngle, sweepAngle, useCenter, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawRect(r, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawRRect(const SkRRect& r, const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawRRect(r, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawPath(path, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawBitmap(const SkBitmap& bitmap,
-                                               SkScalar left,
-                                               SkScalar top,
-                                               const SkPaint* paint) {
-    FILTER_PTR(paint);
-    fProxyTarget->drawBitmap(bitmap, left, top, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawBitmapRect(const SkBitmap& bitmap,
-                                                   const SkRect* src,
-                                                   const SkRect& dst,
-                                                   const SkPaint* paint,
-                                                   SkCanvas::SrcRectConstraint constraint) {
-    FILTER_PTR(paint);
-    fProxyTarget->legacy_drawBitmapRect(bitmap, src, dst, filteredPaint, constraint);
-}
-void SkAndroidSDKCanvas::onDrawBitmapNine(const SkBitmap& bitmap,
-                                                   const SkIRect& center,
-                                                   const SkRect& dst,
-                                                   const SkPaint* paint) {
-    FILTER_PTR(paint);
-    fProxyTarget->drawBitmapNine(bitmap, center, dst, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawVertices(VertexMode vMode,
-                                                 int vertexCount,
-                                                 const SkPoint vertices[],
-                    const SkPoint texs[], const SkColor colors[], SkBlendMode bmode,
-                    const uint16_t indices[], int indexCount,
-                    const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawVertices(vMode, vertexCount, vertices, texs, colors,
-                               bmode, indices, indexCount, filteredPaint);
-}
-
-void SkAndroidSDKCanvas::onDrawDRRect(const SkRRect& outer,
-                                               const SkRRect& inner,
-                                               const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawDRRect(outer, inner, filteredPaint);
-}
-
-void SkAndroidSDKCanvas::onDrawText(const void* text,
-                                             size_t byteLength,
-                                             SkScalar x,
-                                             SkScalar y,
-                                             const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawText(text, byteLength, x, y, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawPosText(const void* text,
-                                                size_t byteLength,
-                                                const SkPoint pos[],
-                                                const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawPosText(text, byteLength, pos, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawPosTextH(const void* text,
-                                                 size_t byteLength,
-                                                 const SkScalar xpos[],
-                                                 SkScalar constY,
-                                                 const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawPosTextH(text, byteLength, xpos, constY, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawTextOnPath(const void* text,
-                                          size_t byteLength,
-                                          const SkPath& path,
-                                          const SkMatrix* matrix,
-                                          const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawTextOnPath(text, byteLength, path, matrix, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawTextRSXform(const void* text, size_t byteLength,
-                                           const SkRSXform xform[], const SkRect* cull,
-                                           const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawTextRSXform(text, byteLength, xform, cull, filteredPaint);
-}
-void SkAndroidSDKCanvas::onDrawTextBlob(const SkTextBlob* blob,
-                                                 SkScalar x,
-                                                 SkScalar y,
-                                                 const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawTextBlob(blob, x, y, filteredPaint);
-}
-
-void SkAndroidSDKCanvas::onDrawPatch(const SkPoint cubics[12],
-                                              const SkColor colors[4],
-                                              const SkPoint texCoords[4],
-                                              SkBlendMode bmode,
-                                              const SkPaint& paint) {
-    FILTER(paint);
-    fProxyTarget->drawPatch(cubics, colors, texCoords, bmode, filteredPaint);
-}
-
-
-void SkAndroidSDKCanvas::onDrawImage(const SkImage* image,
-                                              SkScalar x,
-                                              SkScalar y,
-                                              const SkPaint* paint) {
-    FILTER_PTR(paint);
-    fProxyTarget->drawImage(image, x, y, filteredPaint);
-}
-
-void SkAndroidSDKCanvas::onDrawImageRect(const SkImage* image,
-                                         const SkRect* in,
-                                         const SkRect& out,
-                                         const SkPaint* paint,
-                                         SrcRectConstraint constraint) {
-    FILTER_PTR(paint);
-    fProxyTarget->legacy_drawImageRect(image, in, out, filteredPaint, constraint);
-}
-
-void SkAndroidSDKCanvas::onDrawPicture(const SkPicture* picture,
-                                       const SkMatrix* matrix,
-                                       const SkPaint* paint) {
-    FILTER_PTR(paint);
-    fProxyTarget->drawPicture(picture, matrix, filteredPaint);
-}
-
-void SkAndroidSDKCanvas::onDrawAtlas(const SkImage* atlas,
-                                     const SkRSXform xform[],
-                                     const SkRect tex[],
-                                     const SkColor colors[],
-                                     int count,
-                                     SkBlendMode mode,
-                                     const SkRect* cullRect,
-                                     const SkPaint* paint) {
-    FILTER_PTR(paint);
-    fProxyTarget->drawAtlas(atlas, xform, tex, colors, count, mode, cullRect, filteredPaint);
-}
-
-void SkAndroidSDKCanvas::onDrawImageNine(const SkImage* image,
-                                         const SkIRect& center,
-                                         const SkRect& dst,
-                                         const SkPaint* paint) {
-    FILTER_PTR(paint);
-    fProxyTarget->drawImageNine(image, center, dst, filteredPaint);
-}
-
-
-void SkAndroidSDKCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
-    fProxyTarget->drawDrawable(drawable, matrix);
-}
-
-SkISize SkAndroidSDKCanvas::getBaseLayerSize() const {
-    return fProxyTarget->getBaseLayerSize();
-}
-SkRect SkAndroidSDKCanvas::onGetLocalClipBounds() const {
-    return fProxyTarget->getLocalClipBounds();
-}
-SkIRect SkAndroidSDKCanvas::onGetDeviceClipBounds() const {
-    return fProxyTarget->getDeviceClipBounds();
-}
-
-bool SkAndroidSDKCanvas::isClipEmpty() const { return fProxyTarget->isClipEmpty(); }
-bool SkAndroidSDKCanvas::isClipRect() const { return fProxyTarget->isClipRect(); }
-
-sk_sp<SkSurface> SkAndroidSDKCanvas::onNewSurface(const SkImageInfo& info,
-                                                  const SkSurfaceProps& props) {
-    return fProxyTarget->makeSurface(info, &props);
-}
-
-bool SkAndroidSDKCanvas::onPeekPixels(SkPixmap* pmap) {
-    return fProxyTarget->peekPixels(pmap);
-}
-
-bool SkAndroidSDKCanvas::onAccessTopLayerPixels(SkPixmap* pmap) {
-    SkASSERT(pmap);
-    SkImageInfo info;
-    size_t rowBytes;
-    const void* addr = fProxyTarget->accessTopLayerPixels(&info, &rowBytes, nullptr);
-    if (addr) {
-        pmap->reset(info, addr, rowBytes);
-        return true;
-    }
-    return false;
-}
-
-void SkAndroidSDKCanvas::willSave() {
-    fProxyTarget->save();
-}
-
-SkCanvas::SaveLayerStrategy SkAndroidSDKCanvas::getSaveLayerStrategy(const SaveLayerRec& rec) {
-    fProxyTarget->saveLayer(rec);
-    return SkCanvas::kNoLayer_SaveLayerStrategy;
-}
-
-void SkAndroidSDKCanvas::willRestore() {
-    fProxyTarget->restore();
-}
-
-void SkAndroidSDKCanvas::didRestore() { }
-
-void SkAndroidSDKCanvas::didConcat(const SkMatrix& m) {
-    fProxyTarget->concat(m);
-}
-
-void SkAndroidSDKCanvas::didSetMatrix(const SkMatrix& m) {
-    fProxyTarget->setMatrix(m);
-}
-
-void SkAndroidSDKCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle style) {
-    fProxyTarget->clipRect(rect, op, style);
-}
-
-void SkAndroidSDKCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle style) {
-    fProxyTarget->clipRRect(rrect, op, style);
-}
-
-void SkAndroidSDKCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle style) {
-    fProxyTarget->clipPath(path, op, style);
-}
-
-void SkAndroidSDKCanvas::onClipRegion(const SkRegion& region, SkClipOp op) {
-    fProxyTarget->clipRegion(region, op);
-}
-
-void SkAndroidSDKCanvas::onDiscard() { fProxyTarget->discard(); }
diff --git a/tools/android/SkAndroidSDKCanvas.h b/tools/android/SkAndroidSDKCanvas.h
deleted file mode 100644
index 6b8eb67..0000000
--- a/tools/android/SkAndroidSDKCanvas.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkAndroidSDKCanvas_DEFINED
-#define SkAndroidSDKCanvas_DEFINED
-
-#include "SkBitmap.h"
-#include "SkCanvas.h"
-#include "SkPaint.h"
-#include "SkPath.h"
-#include "SkRect.h"
-
-/** SkDrawFilter is likely to be deprecated; this is a proxy
-    canvas that does the same thing: alter SkPaint fields.
-
-    onDraw*() functions may have their SkPaint modified, and are then
-    passed on to the same function on proxyTarget. THIS BREAKS CONSTNESS!
-
-    This still suffers one of the same architectural flaws as SkDrawFilter:
-    TextBlob paints are incomplete when filter is called.
-*/
-
-class SkAndroidSDKCanvas : public SkCanvas {
-public:
-    SkAndroidSDKCanvas();
-    void reset(SkCanvas* newTarget);
-
-protected:
-
-    // FILTERING
-
-    void onDrawPaint(const SkPaint& paint) override;
-    void onDrawPoints(PointMode pMode, size_t count, const SkPoint pts[],
-                      const SkPaint& paint) override;
-    void onDrawOval(const SkRect& r, const SkPaint& paint) override;
-    void onDrawArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter,
-                   const SkPaint& paint) override;
-    void onDrawRect(const SkRect& r, const SkPaint& paint) override;
-    void onDrawRRect(const SkRRect& r, const SkPaint& paint) override;
-    void onDrawPath(const SkPath& path, const SkPaint& paint) override;
-    void onDrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
-                      const SkPaint* paint) override;
-    void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
-                          const SkPaint* paint, SkCanvas::SrcRectConstraint) override;
-    void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
-                          const SkRect& dst, const SkPaint* paint) override;
-    void onDrawVertices(VertexMode vMode, int vertexCount, const SkPoint vertices[],
-                        const SkPoint texs[], const SkColor colors[], SkBlendMode,
-                        const uint16_t indices[], int indexCount,
-                        const SkPaint& paint) override;
-
-    void onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
-                      const SkPaint& paint) override;
-
-    void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
-                    const SkPaint& paint) override;
-    void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
-                       const SkPaint& paint) override;
-    void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
-                        SkScalar constY, const SkPaint& paint) override;
-    void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
-                          const SkMatrix* matrix, const SkPaint& paint) override;
-    void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
-                           const SkRect* cull, const SkPaint& paint) override;
-    void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
-                        const SkPaint& paint) override;
-
-    void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
-                     const SkPoint texCoords[4], SkBlendMode,
-                     const SkPaint& paint) override;
-
-    void onDrawImage(const SkImage*, SkScalar, SkScalar, const SkPaint*) override;
-    void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*,
-                         SrcRectConstraint) override;
-    void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
-    void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[],
-                     const SkColor[], int count, SkBlendMode,
-                     const SkRect* cull, const SkPaint*) override;
-    void onDrawImageNine(const SkImage*, const SkIRect& center,
-                         const SkRect& dst, const SkPaint*) override;
-
-    // PASS THROUGH
-
-    void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
-    SkISize getBaseLayerSize() const override;
-    SkRect onGetLocalClipBounds() const override;
-    SkIRect onGetDeviceClipBounds() const override;
-    bool isClipEmpty() const override;
-    bool isClipRect() const override;
-    sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
-    bool onPeekPixels(SkPixmap*) override;
-    bool onAccessTopLayerPixels(SkPixmap*) override;
-    void willSave() override;
-    SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
-    void willRestore() override;
-    void didRestore() override;
-    void didConcat(const SkMatrix&) override;
-    void didSetMatrix(const SkMatrix&) override;
-    void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override;
-    void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override;
-    void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override;
-    void onClipRegion(const SkRegion&, SkClipOp) override;
-    void onDiscard() override;
-
-protected:
-    SkCanvas* fProxyTarget;
-};
-
-#endif  // SkAndroidSDKCanvas_DEFINED