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
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index d3e01b7..f9de53c 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -182,6 +182,26 @@
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 @@
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 gRegLC00(FactLC00);
static BenchRegistry gRegLC01(FactLC01);
+static BenchRegistry gRegLL00(FactLL00);
+static BenchRegistry gRegLL01(FactLL01);
+