aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/ColorFilterBench.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2015-04-02 20:31:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-02 20:31:17 -0700
commitaa4c7a704289b7adcbfbd23580667a1950a9ca6e (patch)
treea1db3dce66d6466a1d3515b982cb6c2b80d2a3f2 /bench/ColorFilterBench.cpp
parent92dabe7421aa6ba4149901108d8ab72956f67eeb (diff)
remove useless benches
The colorfilter is applied to a single (paint's) color, so the bench does not measure the filter at all, but simply the blit of a color. BUG=skia: TBR= Review URL: https://codereview.chromium.org/1055383002
Diffstat (limited to 'bench/ColorFilterBench.cpp')
-rw-r--r--bench/ColorFilterBench.cpp76
1 files changed, 4 insertions, 72 deletions
diff --git a/bench/ColorFilterBench.cpp b/bench/ColorFilterBench.cpp
index 04803b57b3..4f7f1517dd 100644
--- a/bench/ColorFilterBench.cpp
+++ b/bench/ColorFilterBench.cpp
@@ -4,6 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
#include "Benchmark.h"
#include "SkCanvas.h"
#include "SkColorFilterImageFilter.h"
@@ -19,7 +20,7 @@
class ColorFilterBaseBench : public Benchmark {
public:
- ColorFilterBaseBench(bool small) : fIsSmall(small) { }
+ ColorFilterBaseBench(bool small) : fIsSmall(small) {}
protected:
SkRect getFilterRect() const {
@@ -55,6 +56,7 @@ protected:
}
inline bool isSmall() const { return fIsSmall; }
+
private:
bool fIsSmall;
@@ -254,8 +256,7 @@ private:
class ColorFilterGrayBench : public ColorFilterBaseBench {
public:
- ColorFilterGrayBench(bool small) : INHERITED(small) {
- }
+ ColorFilterGrayBench(bool small) : INHERITED(small) {}
protected:
const char* onGetName() override {
@@ -277,71 +278,6 @@ private:
typedef ColorFilterBaseBench INHERITED;
};
-class TableColorFilterBench : public ColorFilterBaseBench {
-
-public:
- TableColorFilterBench(bool small) : INHERITED(small) {
- }
-
-protected:
- const char* onGetName() override {
- return isSmall() ? "table_colorfilter_small" : "table_colorfilter_large";
- }
-
- void onDraw(const int loops, SkCanvas* canvas) override {
- SkRect r = getFilterRect();
- SkPaint paint;
- paint.setColor(SK_ColorRED);
- for (int i = 0; i < loops; i++) {
- SkAutoTUnref<SkColorFilter> table_filter(make_table_filter());
- paint.setColorFilter(table_filter);
- canvas->drawRect(r, paint);
- }
- }
-
-private:
- static void fill_table_data(uint8_t table[]) {
- for (int i = 0; i < 256; ++i) {
- int n = i >> 5;
- table[i] = (n << 5) | (n << 2) | (n >> 1);
- }
- }
-
- static SkColorFilter* make_table_filter() {
- uint8_t table[256]; fill_table_data(table);
- return SkTableColorFilter::Create(table);
- }
-
- typedef ColorFilterBaseBench INHERITED;
-};
-
-class LumaColorFilterBench : public ColorFilterBaseBench {
-
-public:
- LumaColorFilterBench(bool small) : INHERITED(small) {
- }
-
-protected:
- const char* onGetName() override {
- return isSmall() ? "luma_colorfilter_small" : "luma_colorfilter_large";
- }
-
- void onDraw(const int loops, SkCanvas* canvas) override {
- SkRect r = getFilterRect();
- SkPaint paint;
- paint.setColor(SK_ColorRED);
-
- for (int i = 0; i < loops; i++) {
- SkAutoTUnref<SkColorFilter> luma_filter(SkLumaColorFilter::Create());
- paint.setColorFilter(luma_filter);
- canvas->drawRect(r, paint);
- }
- }
-
-private:
- typedef ColorFilterBaseBench INHERITED;
-};
-
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new ColorFilterDimBrightBench(true); )
@@ -352,8 +288,6 @@ DEF_BENCH( return new ColorFilterBrightBlueBench(true); )
DEF_BENCH( return new ColorFilterBrightBench(true); )
DEF_BENCH( return new ColorFilterBlueBench(true); )
DEF_BENCH( return new ColorFilterGrayBench(true); )
-DEF_BENCH( return new TableColorFilterBench(true); )
-DEF_BENCH( return new LumaColorFilterBench(true); )
DEF_BENCH( return new ColorFilterDimBrightBench(false); )
DEF_BENCH( return new ColorFilterBrightGrayBench(false); )
@@ -363,5 +297,3 @@ DEF_BENCH( return new ColorFilterBrightBlueBench(false); )
DEF_BENCH( return new ColorFilterBrightBench(false); )
DEF_BENCH( return new ColorFilterBlueBench(false); )
DEF_BENCH( return new ColorFilterGrayBench(false); )
-DEF_BENCH( return new TableColorFilterBench(false); )
-DEF_BENCH( return new LumaColorFilterBench(false); )