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
diff --git a/bench/PerlinNoiseBench.cpp b/bench/PerlinNoiseBench.cpp
index 7cbe5f8..85b536b 100644
--- a/bench/PerlinNoiseBench.cpp
+++ b/bench/PerlinNoiseBench.cpp
@@ -21,9 +21,9 @@
return "perlinnoise";
}
- virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
- this->test(canvas, 0, 0, SkPerlinNoiseShader::kFractalNoise_Type,
- 0.1f, 0.1f, 3, 0, false);
+ virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
+ this->test(loops, canvas, 0, 0, SkPerlinNoiseShader::kFractalNoise_Type,
+ 0.1f, 0.1f, 3, 0, false);
}
private:
@@ -38,7 +38,7 @@
canvas->restore();
}
- void test(SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Type type,
+ void test(const int loops, SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Type type,
float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed,
bool stitchTiles) {
SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ?
@@ -49,7 +49,7 @@
SkPaint paint;
paint.setShader(shader)->unref();
- for (int i = 0; i < this->getLoops(); i++) {
+ for (int i = 0; i < loops; i++) {
this->drawClippedRect(canvas, x, y, paint);
}
}