diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-03 18:17:16 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-03 18:17:16 +0000 |
commit | 3361471a3504ecd0351ff70f4c42d8d6fee963d4 (patch) | |
tree | 1886e770069303c70c588c396b2d9c19343e3adc /bench/DashBench.cpp | |
parent | e3bb3bce3e9c1f3bc8ee779b1b3383c18e560bce (diff) |
Simplify benchmark internal API.
I'm not quite sure why I wrote such a convoluted API with setLoops()/getLoops().
This replaces it with a loops argument passed to onDraw().
This CL is largely mechanical translation from the old API to the new one.
MathBench used this->getLoops() outside onDraw(), which seems incorrect. I
fixed it.
BUG=
R=djsollen@google.com
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/99893003
git-svn-id: http://skia.googlecode.com/svn/trunk@12466 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/DashBench.cpp')
-rw-r--r-- | bench/DashBench.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp index 040dfd568d..2e4bc376bc 100644 --- a/bench/DashBench.cpp +++ b/bench/DashBench.cpp @@ -61,7 +61,7 @@ protected: return fName.c_str(); } - virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { + virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { SkPaint paint; this->setupPaint(&paint); paint.setStyle(SkPaint::kStroke_Style); @@ -82,7 +82,7 @@ protected: canvas->clipRect(r); } - this->handlePath(canvas, path, paint, this->getLoops()); + this->handlePath(canvas, path, paint, loops); } virtual void handlePath(SkCanvas* canvas, const SkPath& path, @@ -194,9 +194,9 @@ protected: return fName.c_str(); } - virtual void onDraw(SkCanvas*) SK_OVERRIDE { + virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE { SkPath dst; - for (int i = 0; i < this->getLoops(); ++i) { + for (int i = 0; i < loops; ++i) { SkStrokeRec rec(SkStrokeRec::kHairline_InitStyle); fPE->filterPath(&dst, fPath, &rec, NULL); @@ -232,13 +232,13 @@ protected: return fName.c_str(); } - virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { + virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { SkPaint paint; this->setupPaint(&paint); paint.setStrokeWidth(fStrokeWidth); paint.setStrokeCap(fIsRound ? SkPaint::kRound_Cap : SkPaint::kSquare_Cap); paint.setPathEffect(fPE); - for (int i = 0; i < this->getLoops(); ++i) { + for (int i = 0; i < loops; ++i) { canvas->drawLine(10 * SK_Scalar1, 10 * SK_Scalar1, 640 * SK_Scalar1, 10 * SK_Scalar1, paint); } @@ -271,7 +271,7 @@ protected: return fName.c_str(); } - virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { + virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { SkPaint p; this->setupPaint(&p); p.setColor(SK_ColorBLACK); @@ -285,7 +285,7 @@ protected: { SkIntToScalar(640), 0 } }; - for (int i = 0; i < this->getLoops(); ++i) { + for (int i = 0; i < loops; ++i) { pts[0].fY = pts[1].fY = SkIntToScalar(i % 480); canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p); } @@ -357,14 +357,14 @@ protected: return fName.c_str(); } - virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { + virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { SkPaint p; this->setupPaint(&p); p.setStyle(SkPaint::kStroke_Style); p.setStrokeWidth(fStrokeWidth); p.setPathEffect(fPathEffect); - for (int i = 0; i < this->getLoops(); i++) { + for (int i = 0; i < loops; i++) { canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p); } } |