From e50f7361b4ee9fc8968e0e8a511379b3bf5f5123 Mon Sep 17 00:00:00 2001 From: "senorblanco@chromium.org" Date: Thu, 12 Jan 2012 19:10:35 +0000 Subject: Add a wide stroked line path benchmark to bench. It uses the same stroke width and endcap style as the stroked curved path. Review URL: http://codereview.appspot.com/5529069/ git-svn-id: http://skia.googlecode.com/svn/trunk@3028 2bbb7eff-a529-9590-31e7-b0007b416f81 --- bench/PathBench.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp index d3e01b7ff2..f9de53c9f0 100644 --- a/bench/PathBench.cpp +++ b/bench/PathBench.cpp @@ -182,6 +182,26 @@ private: typedef PathBench INHERITED; }; +class LongLinePathBench : public PathBench { +public: + LongLinePathBench(void * param, Flags flags) + : INHERITED(param, flags) { + } + + virtual void appendName(SkString* name) { + name->append("long_line"); + } + virtual void makePath(SkPath* path) { + SkRandom rand; + path->moveTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); + for (size_t i = 1; i < 100; i++) { + path->lineTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); + } + } + virtual int complexity() { return 2; } +private: + typedef PathBench INHERITED; +}; static SkBenchmark* FactT00(void* p) { return new TrianglePathBench(p, FLAGS00); } @@ -209,6 +229,14 @@ static SkBenchmark* FactLC01(void* p) { return new LongCurvedPathBench(p, FLAGS01); } +static SkBenchmark* FactLL00(void* p) { + return new LongLinePathBench(p, FLAGS00); +} + +static SkBenchmark* FactLL01(void* p) { + return new LongLinePathBench(p, FLAGS01); +} + static BenchRegistry gRegT00(FactT00); static BenchRegistry gRegT01(FactT01); static BenchRegistry gRegT10(FactT10); @@ -230,3 +258,6 @@ static BenchRegistry gRegS01(FactS01); static BenchRegistry gRegLC00(FactLC00); static BenchRegistry gRegLC01(FactLC01); +static BenchRegistry gRegLL00(FactLL00); +static BenchRegistry gRegLL01(FactLL01); + -- cgit v1.2.3