From c289743864e2ab926a95e617a5cd1d29b26d1825 Mon Sep 17 00:00:00 2001 From: "mtklein@google.com" Date: Tue, 10 Sep 2013 19:23:38 +0000 Subject: 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 --- bench/BitmapBench.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'bench/BitmapBench.cpp') diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp index a472d2489f..698a680e9c 100644 --- a/bench/BitmapBench.cpp +++ b/bench/BitmapBench.cpp @@ -81,8 +81,6 @@ class BitmapBench : public SkBenchmark { 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 @@ protected: 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 @@ protected: } } - 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 @@ static bool isBicubic(uint32_t flags) { 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) -- cgit v1.2.3