Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Unified Diff: bench/ColorFilterBench.cpp

Issue 25453004: Luminance-to-alpha color filter (SkLumaColorFilter). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Added test & more docs. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/lumafilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/ColorFilterBench.cpp
diff --git a/bench/ColorFilterBench.cpp b/bench/ColorFilterBench.cpp
index e30b00596441f7b3d678aed2eeb973026c42c8d4..6d98a0eabc74f0e2bddab29ee649f02fa9397464 100644
--- a/bench/ColorFilterBench.cpp
+++ b/bench/ColorFilterBench.cpp
@@ -8,6 +8,7 @@
#include "SkCanvas.h"
#include "SkColorFilterImageFilter.h"
#include "SkColorMatrixFilter.h"
+#include "SkLumaColorFilter.h"
#include "SkTableColorFilter.h"
#define FILTER_WIDTH_SMALL SkIntToScalar(32)
@@ -314,6 +315,33 @@ private:
typedef ColorFilterBaseBench INHERITED;
};
+class LumaColorFilterBench : public ColorFilterBaseBench {
+
+public:
+ LumaColorFilterBench(bool small) : INHERITED(small) {
+ }
+
+protected:
+ virtual const char* onGetName() SK_OVERRIDE {
+ return isSmall() ? "luma_colorfilter_small" : "luma_colorfilter_large";
+ }
+
+ virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
+ SkRect r = getFilterRect();
+ SkPaint paint;
+ paint.setColor(SK_ColorRED);
+
+ for (int i = 0; i < this->getLoops(); 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); )
@@ -325,6 +353,7 @@ 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); )
@@ -335,3 +364,4 @@ 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); )
« no previous file with comments | « no previous file | gm/lumafilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698