aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/RectBench.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-03 18:17:16 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-03 18:17:16 +0000
commit3361471a3504ecd0351ff70f4c42d8d6fee963d4 (patch)
tree1886e770069303c70c588c396b2d9c19343e3adc /bench/RectBench.cpp
parente3bb3bce3e9c1f3bc8ee779b1b3383c18e560bce (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/RectBench.cpp')
-rw-r--r--bench/RectBench.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp
index 200fb0d330..ee0f76b812 100644
--- a/bench/RectBench.cpp
+++ b/bench/RectBench.cpp
@@ -62,13 +62,13 @@ protected:
}
virtual const char* onGetName() { return computeName("rects"); }
- virtual void onDraw(SkCanvas* canvas) {
+ virtual void onDraw(const int loops, SkCanvas* canvas) {
SkPaint paint;
if (fStroke > 0) {
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SkIntToScalar(fStroke));
}
- for (int i = 0; i < this->getLoops(); i++) {
+ for (int i = 0; i < loops; i++) {
paint.setColor(fColors[i % N]);
this->setupPaint(&paint);
this->drawThisRect(canvas, fRects[i % N], paint);
@@ -141,7 +141,7 @@ public:
}
protected:
- virtual void onDraw(SkCanvas* canvas) {
+ virtual void onDraw(const int loops, SkCanvas* canvas) {
SkScalar gSizes[] = {
SkIntToScalar(7), 0
};
@@ -155,7 +155,7 @@ protected:
SkPaint paint;
paint.setStrokeCap(SkPaint::kRound_Cap);
- for (int loop = 0; loop < this->getLoops(); loop++) {
+ for (int loop = 0; loop < loops; loop++) {
for (size_t i = 0; i < sizes; i++) {
paint.setStrokeWidth(gSizes[i]);
this->setupPaint(&paint);
@@ -185,7 +185,7 @@ protected:
return "aarects";
}
- virtual void onDraw(SkCanvas* canvas) {
+ virtual void onDraw(const int loops, SkCanvas* canvas) {
static const SkScalar kHalfRectSize = 0.75f;
SkPaint paint;
@@ -195,7 +195,7 @@ protected:
SkRect r = { -kHalfRectSize, -kHalfRectSize, kHalfRectSize, kHalfRectSize };
int rot = 0;
- for (int i = 0; i < this->getLoops(); i++) {
+ for (int i = 0; i < loops; i++) {
// Draw small aa rects in a grid across the screen
for (SkScalar y = kHalfRectSize+SK_Scalar1; y < H; y += 2*kHalfRectSize+2) {
for (SkScalar x = kHalfRectSize+SK_Scalar1; x < W; x += 2*kHalfRectSize+2) {
@@ -243,7 +243,7 @@ public:
}
protected:
- virtual void onDraw(SkCanvas* canvas) {
+ virtual void onDraw(const int loops, SkCanvas* canvas) {
SkScalar gSizes[] = {
SkIntToScalar(13), SkIntToScalar(24)
};
@@ -269,7 +269,7 @@ protected:
SkShader::kClamp_TileMode);
paint.setShader(s)->unref();
}
- for (int loop = 0; loop < this->getLoops(); loop++) {
+ for (int loop = 0; loop < loops; loop++) {
for (size_t i = 0; i < sizes; i++) {
switch (_type) {
case kMaskOpaque: