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/ColorFilterBench.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'bench/ColorFilterBench.cpp') diff --git a/bench/ColorFilterBench.cpp b/bench/ColorFilterBench.cpp index 22a0472b1b..2ac78ae128 100644 --- a/bench/ColorFilterBench.cpp +++ b/bench/ColorFilterBench.cpp @@ -76,11 +76,14 @@ protected: SkRect r = getFilterRect(); SkPaint paint; paint.setColor(SK_ColorRED); - for (float brightness = -1.0f; brightness <= 1.0f; brightness += 0.4f) { - SkAutoTUnref dim(make_brightness(-brightness)); - SkAutoTUnref bright(make_brightness(brightness, dim)); - paint.setImageFilter(bright); - canvas->drawRect(r, paint); + + for (int i = 0; i < this->getLoops(); i++) { + for (float brightness = -1.0f; brightness <= 1.0f; brightness += 0.4f) { + SkAutoTUnref dim(make_brightness(-brightness)); + SkAutoTUnref bright(make_brightness(brightness, dim)); + paint.setImageFilter(bright); + canvas->drawRect(r, paint); + } } } @@ -103,7 +106,7 @@ protected: SkRect r = getFilterRect(); SkPaint paint; paint.setColor(SK_ColorRED); - { + for (int i = 0; i < this->getLoops(); i++) { SkAutoTUnref brightness(make_brightness(0.9f)); SkAutoTUnref grayscale(make_grayscale(brightness)); paint.setImageFilter(grayscale); @@ -130,7 +133,7 @@ protected: SkRect r = getFilterRect(); SkPaint paint; paint.setColor(SK_ColorRED); - { + for (int i = 0; i < this->getLoops(); i++) { SkAutoTUnref grayscale(make_grayscale()); SkAutoTUnref brightness(make_brightness(0.9f, grayscale)); paint.setImageFilter(brightness); @@ -157,7 +160,7 @@ protected: SkRect r = getFilterRect(); SkPaint paint; paint.setColor(SK_ColorRED); - { + for (int i = 0; i < this->getLoops(); i++) { SkAutoTUnref blue(make_mode_blue()); SkAutoTUnref brightness(make_brightness(1.0f, blue)); paint.setImageFilter(brightness); @@ -184,7 +187,7 @@ protected: SkRect r = getFilterRect(); SkPaint paint; paint.setColor(SK_ColorRED); - { + for (int i = 0; i < this->getLoops(); i++) { SkAutoTUnref brightness(make_brightness(1.0f)); SkAutoTUnref blue(make_mode_blue(brightness)); paint.setImageFilter(blue); @@ -211,7 +214,7 @@ protected: SkRect r = getFilterRect(); SkPaint paint; paint.setColor(SK_ColorRED); - { + for (int i = 0; i < this->getLoops(); i++) { SkAutoTUnref brightness(make_brightness(1.0f)); paint.setImageFilter(brightness); canvas->drawRect(r, paint); @@ -237,7 +240,7 @@ protected: SkRect r = getFilterRect(); SkPaint paint; paint.setColor(SK_ColorRED); - { + for (int i = 0; i < this->getLoops(); i++) { SkAutoTUnref blue(make_mode_blue()); paint.setImageFilter(blue); canvas->drawRect(r, paint); @@ -263,7 +266,7 @@ protected: SkRect r = getFilterRect(); SkPaint paint; paint.setColor(SK_ColorRED); - { + for (int i = 0; i < this->getLoops(); i++) { SkAutoTUnref grayscale(make_grayscale()); paint.setImageFilter(grayscale); canvas->drawRect(r, paint); @@ -289,7 +292,7 @@ protected: SkRect r = getFilterRect(); SkPaint paint; paint.setColor(SK_ColorRED); - { + for (int i = 0; i < this->getLoops(); i++) { SkAutoTUnref table_filter(make_table_filter()); paint.setColorFilter(table_filter); canvas->drawRect(r, paint); -- cgit v1.2.3