aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/PathBench.cpp
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-12 19:10:35 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-12 19:10:35 +0000
commite50f7361b4ee9fc8968e0e8a511379b3bf5f5123 (patch)
tree3d471bcd0a2fbb3abc2dc884d8b853294afd80ee /bench/PathBench.cpp
parentd335d1d784167f8b9a4bf8a35e04d8e82d0a9507 (diff)
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
Diffstat (limited to 'bench/PathBench.cpp')
-rw-r--r--bench/PathBench.cpp31
1 files changed, 31 insertions, 0 deletions
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);
+