diff options
author | Mike Reed <reed@google.com> | 2017-02-03 11:34:13 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-03 17:26:43 +0000 |
commit | 8d3196bdfcf478982bec9885d21e1d664ab9a72b (patch) | |
tree | 565d17927c9bb022cdb7bf10108bf7fc52b7a5db /bench/PathBench.cpp | |
parent | 20f00784b8500ccb68f0e402eeccd9bbf2707040 (diff) |
expose new tight-bounds method on SkPath
BUG=skia:
Change-Id: Ie50df49c1758af203042a84dc2cd505046373d2c
Reviewed-on: https://skia-review.googlesource.com/7996
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'bench/PathBench.cpp')
-rw-r--r-- | bench/PathBench.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp index de8be6c758..10cffc20c2 100644 --- a/bench/PathBench.cpp +++ b/bench/PathBench.cpp @@ -1079,10 +1079,10 @@ private: class TightBoundsBench : public Benchmark { SkPath fPath; SkString fName; - bool (*fProc)(const SkPath&, SkRect*); + SkRect (*fProc)(const SkPath&); public: - TightBoundsBench(bool (*proc)(const SkPath&, SkRect*), const char suffix[]) : fProc(proc) { + TightBoundsBench(SkRect (*proc)(const SkPath&), const char suffix[]) : fProc(proc) { fName.printf("tight_bounds_%s", suffix); const int N = 100; @@ -1106,9 +1106,8 @@ protected: const char* onGetName() override { return fName.c_str(); } void onDraw(int loops, SkCanvas* canvas) override { - SkRect bounds; for (int i = 0; i < loops*100; ++i) { - fProc(fPath, &bounds); + fProc(fPath); } } @@ -1186,8 +1185,11 @@ DEF_BENCH( return new ConservativelyContainsBench(ConservativelyContainsBench::k #include "SkPathOps.h" #include "SkPathPriv.h" -DEF_BENCH( return new TightBoundsBench(SkPathPriv::ComputeTightBounds, "priv"); ) -DEF_BENCH( return new TightBoundsBench(TightBounds, "pathops"); ) +DEF_BENCH( return new TightBoundsBench([](const SkPath& path){ return path.computeTightBounds();}, + "priv"); ) +DEF_BENCH( return new TightBoundsBench([](const SkPath& path) { + SkRect bounds; TightBounds(path, &bounds); return bounds; + }, "pathops"); ) // These seem to be optimized away, which is troublesome for timing. /* |