aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/DashBench.cpp
diff options
context:
space:
mode:
authorGravatar mtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-10 19:23:38 +0000
committerGravatar mtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-10 19:23:38 +0000
commitc289743864e2ab926a95e617a5cd1d29b26d1825 (patch)
tree2c559da19185181efd8bd92791fb758af5969800 /bench/DashBench.cpp
parent55ebe8eca0063ab1f3979d629749bc41ec409ac1 (diff)
Major bench refactoring.
- Use FLAGS_. - Remove outer repeat loop. - Tune inner loop automatically. BUG=skia:1590 R=epoger@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/23478013 git-svn-id: http://skia.googlecode.com/svn/trunk@11187 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/DashBench.cpp')
-rw-r--r--bench/DashBench.cpp29
1 files changed, 7 insertions, 22 deletions
diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp
index 0fcde316b9..84fe3ab752 100644
--- a/bench/DashBench.cpp
+++ b/bench/DashBench.cpp
@@ -37,9 +37,6 @@ protected:
SkPoint fPts[2];
bool fDoClip;
- enum {
- N = SkBENCHLOOP(100)
- };
public:
DashBench(void* param, const SkScalar intervals[], int count, int width,
bool doClip = false) : INHERITED(param) {
@@ -85,7 +82,7 @@ protected:
canvas->clipRect(r);
}
- this->handlePath(canvas, path, paint, N);
+ this->handlePath(canvas, path, paint, this->getLoops());
}
virtual void handlePath(SkCanvas* canvas, const SkPath& path,
@@ -183,10 +180,6 @@ class MakeDashBench : public SkBenchmark {
SkPath fPath;
SkAutoTUnref<SkPathEffect> fPE;
- enum {
- N = SkBENCHLOOP(400)
- };
-
public:
MakeDashBench(void* param, void (*proc)(SkPath*), const char name[]) : INHERITED(param) {
fName.printf("makedash_%s", name);
@@ -203,7 +196,7 @@ protected:
virtual void onDraw(SkCanvas*) SK_OVERRIDE {
SkPath dst;
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
SkStrokeRec rec(SkStrokeRec::kHairline_InitStyle);
fPE->filterPath(&dst, fPath, &rec, NULL);
@@ -224,10 +217,6 @@ class DashLineBench : public SkBenchmark {
bool fIsRound;
SkAutoTUnref<SkPathEffect> fPE;
- enum {
- N = SkBENCHLOOP(200)
- };
-
public:
DashLineBench(void* param, SkScalar width, bool isRound) : INHERITED(param) {
fName.printf("dashline_%g_%s", SkScalarToFloat(width), isRound ? "circle" : "square");
@@ -249,7 +238,7 @@ protected:
paint.setStrokeWidth(fStrokeWidth);
paint.setStrokeCap(fIsRound ? SkPaint::kRound_Cap : SkPaint::kSquare_Cap);
paint.setPathEffect(fPE);
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
canvas->drawLine(10 * SK_Scalar1, 10 * SK_Scalar1,
640 * SK_Scalar1, 10 * SK_Scalar1, paint);
}
@@ -266,10 +255,6 @@ class DrawPointsDashingBench : public SkBenchmark {
SkAutoTUnref<SkPathEffect> fPathEffect;
- enum {
- N = SkBENCHLOOP(480)
- };
-
public:
DrawPointsDashingBench(void* param, int dashLength, int strokeWidth, bool doAA)
: INHERITED(param) {
@@ -287,7 +272,6 @@ protected:
}
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
-
SkPaint p;
this->setupPaint(&p);
p.setColor(SK_ColorBLACK);
@@ -301,8 +285,7 @@ protected:
{ SkIntToScalar(640), 0 }
};
- for (int i = 0; i < N; ++i) {
-
+ for (int i = 0; i < this->getLoops(); ++i) {
pts[0].fY = pts[1].fY = SkIntToScalar(i % 480);
canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p);
}
@@ -381,7 +364,9 @@ protected:
p.setStrokeWidth(fStrokeWidth);
p.setPathEffect(fPathEffect);
- canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p);
+ for (int i = 0; i < this->getLoops(); i++) {
+ canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p);
+ }
}
private: