aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/DashBench.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-24 17:33:21 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-24 17:33:21 +0000
commite5ceea9232ecdb76d3b2457146e7dcfd28c3d0fb (patch)
tree8948145b3c40c6fd4fc79c52eb246081e5c5369e /bench/DashBench.cpp
parent996f64f8e752fb1207d446320c0fcce8505c5611 (diff)
update to emphasis the culling aspect of the test (making the line much longer,
and adding hairline and non-hairline cases.) git-svn-id: http://skia.googlecode.com/svn/trunk@7371 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/DashBench.cpp')
-rw-r--r--bench/DashBench.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp
index 9b783b4f9b..42e23fd8f3 100644
--- a/bench/DashBench.cpp
+++ b/bench/DashBench.cpp
@@ -312,16 +312,13 @@ private:
typedef SkBenchmark INHERITED;
};
-
+// Want to test how we handle dashing when 99% of the dash is clipped out
class GiantDashBench : public SkBenchmark {
SkString fName;
+ SkScalar fStrokeWidth;
SkPoint fPts[2];
SkAutoTUnref<SkPathEffect> fPathEffect;
- enum {
- N = SkBENCHLOOP(10)
- };
-
public:
enum LineType {
kHori_LineType,
@@ -335,9 +332,10 @@ public:
return gNames[lt];
}
- GiantDashBench(void* param, LineType lt) : INHERITED(param) {
- fName.printf("giantdashline_%s", LineTypeName(lt));
-
+ GiantDashBench(void* param, LineType lt, SkScalar width) : INHERITED(param) {
+ fName.printf("giantdashline_%s_%g", LineTypeName(lt), width);
+ fStrokeWidth = width;
+
// deliberately pick intervals that won't be caught by asPoints(), so
// we can test the filterPath code-path.
const SkScalar intervals[] = { 2, 1 };
@@ -360,7 +358,7 @@ public:
break;
}
- const SkScalar overshoot = 10*1000;
+ const SkScalar overshoot = 100*1000;
const SkPoint pts[2] = {
{ -overshoot, cy }, { 640 + overshoot, cy }
};
@@ -376,12 +374,10 @@ protected:
SkPaint p;
this->setupPaint(&p);
p.setStyle(SkPaint::kStroke_Style);
- p.setStrokeWidth(1);
+ p.setStrokeWidth(fStrokeWidth);
p.setPathEffect(fPathEffect);
- for (int i = 0; i < N; ++i) {
- canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p);
- }
+ canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p);
}
private:
@@ -416,6 +412,13 @@ DEF_BENCH( return new DrawPointsDashingBench(p, 3, 1, true); )
DEF_BENCH( return new DrawPointsDashingBench(p, 5, 5, false); )
DEF_BENCH( return new DrawPointsDashingBench(p, 5, 5, true); )
-DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kHori_LineType); )
-DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kVert_LineType); )
-DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kDiag_LineType); )
+DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kHori_LineType, 0); )
+DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kVert_LineType, 0); )
+DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kDiag_LineType, 0); )
+
+// pass 2 to explicitly avoid any 1-is-the-same-as-hairline special casing
+
+// hori_2 is just too slow to enable at the moment
+//DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kHori_LineType, 2); )
+DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kVert_LineType, 2); )
+DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kDiag_LineType, 2); )