aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/PatchBench.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-05-22 22:45:05 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-23 03:08:17 +0000
commiteee762104c75bdc42afb71bb64b4986461d7e9ca (patch)
tree193ff88627a0e1e63de7a23556f25fdb28fd908b /bench/PatchBench.cpp
parent79a1a97db7c46f8828af47541643750b488804a2 (diff)
add bench for patchutils
Bug: skia: Change-Id: Iba36eb5a7d09f92b7828f2ec209cbfeb8d0eb8ed Reviewed-on: https://skia-review.googlesource.com/17601 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'bench/PatchBench.cpp')
-rw-r--r--bench/PatchBench.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/bench/PatchBench.cpp b/bench/PatchBench.cpp
index d1d253bebe..4ca4bc8f5e 100644
--- a/bench/PatchBench.cpp
+++ b/bench/PatchBench.cpp
@@ -322,3 +322,34 @@ DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f),
PatchBench::kTexCoords_VertexMode); )
DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f),
PatchBench::kBoth_VertexMode); )
+
+//////////////////////////////////////////////
+#include "SkPatchUtils.h"
+
+class PatchUtilsBench : public Benchmark {
+public:
+ const char* onGetName() override {
+ return "patchutils";
+ }
+
+ bool isSuitableFor(Backend backend) override {
+ return backend == kNonRendering_Backend;
+ }
+
+ void onDraw(int, SkCanvas*) override {
+ const SkColor colors[] = { 0xFF000000, 0xFF00FF00, 0xFF0000FF, 0xFFFF0000 };
+ const SkPoint pts[] = {
+ { 0, 0 }, { 10, 0 }, { 20, 0 }, { 30, 0 },
+ { 30,10}, { 30,20 }, { 30,30 }, { 20,30 },
+ { 10,30}, { 0, 30 }, { 0, 20 }, { 0, 10 },
+ };
+ const SkPoint tex[] = {
+ { 0, 0 }, { 10, 0 }, { 10, 10 }, { 0, 10 },
+ };
+
+ for (int i = 0; i < 100; ++i) {
+ SkPatchUtils::MakeVertices(pts, colors, tex, 20, 20);
+ }
+ }
+};
+DEF_BENCH( return new PatchUtilsBench; )