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
diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp
index a472d24..698a680 100644
--- a/bench/BitmapBench.cpp
+++ b/bench/BitmapBench.cpp
@@ -81,8 +81,6 @@
bool fIsVolatile;
SkBitmap::Config fConfig;
SkString fName;
- enum { BICUBIC_DUR_SCALE = 20 };
- enum { N = SkBENCHLOOP(15 * BICUBIC_DUR_SCALE) };
enum { W = 128 };
enum { H = 128 };
public:
@@ -146,14 +144,7 @@
const SkScalar x0 = SkIntToScalar(-bitmap.width() / 2);
const SkScalar y0 = SkIntToScalar(-bitmap.height() / 2);
- int count = N;
-#ifdef SK_RELEASE
- // in DEBUG, N is always 1
- if (SkPaint::kHigh_FilterLevel == paint.getFilterLevel()) {
- count /= BICUBIC_DUR_SCALE;
- }
-#endif
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < this->getLoops(); i++) {
SkScalar x = x0 + rand.nextUScalar1() * dim.fX;
SkScalar y = y0 + rand.nextUScalar1() * dim.fY;
@@ -164,17 +155,6 @@
}
}
- virtual float onGetDurationScale() SK_OVERRIDE {
- SkPaint paint;
- this->setupPaint(&paint);
-#ifdef SK_DEBUG
- return 1;
-#else
- return SkPaint::kHigh_FilterLevel == paint.getFilterLevel() ?
- (float)BICUBIC_DUR_SCALE : 1;
-#endif
- }
-
virtual void onDrawIntoBitmap(const SkBitmap& bm) {
const int w = bm.width();
const int h = bm.height();
@@ -219,7 +199,6 @@
class FilterBitmapBench : public BitmapBench {
uint32_t fFlags;
SkString fFullName;
- enum { N = SkBENCHLOOP(300) };
public:
FilterBitmapBench(void* param, bool isOpaque, SkBitmap::Config c,
bool forceUpdate, bool isVolitile, uint32_t flags)