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

Unified Diff: gm/matriximagefilter.cpp

Issue 1333553002: GM: replace boilerplate with macros (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-09-09 (Wednesday) 11:01:10 EDT Created 5 years, 3 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 | « gm/linepaths.cpp ('k') | gm/mipmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/matriximagefilter.cpp
diff --git a/gm/matriximagefilter.cpp b/gm/matriximagefilter.cpp
index b4242a7e60f293c0837119b0e6ce247523601f43..3b4c0f6ecb47c3b3e4da4b5220c5595502c2af8f 100644
--- a/gm/matriximagefilter.cpp
+++ b/gm/matriximagefilter.cpp
@@ -9,21 +9,8 @@
#include "SkColor.h"
#include "SkImageFilter.h"
-namespace skiagm {
-
-class MatrixImageFilterGM : public GM {
-public:
- MatrixImageFilterGM() {
- this->setBGColor(0x00000000);
- }
-
-protected:
- virtual SkString onShortName() {
- return SkString("matriximagefilter");
- }
-
- void draw(SkCanvas* canvas, const SkRect& rect, const SkBitmap& bitmap,
- const SkMatrix& matrix, SkFilterQuality filter) {
+static void draw(SkCanvas* canvas, const SkRect& rect, const SkBitmap& bitmap,
+ const SkMatrix& matrix, SkFilterQuality filter) {
SkAutoTUnref<SkImageFilter> imageFilter(
SkImageFilter::CreateMatrixFilter(matrix, filter));
SkPaint paint;
@@ -31,13 +18,9 @@ protected:
canvas->saveLayer(&rect, &paint);
canvas->drawBitmap(bitmap, 0, 0);
canvas->restore();
- }
-
- virtual SkISize onISize() {
- return SkISize::Make(420, 100);
- }
+}
- void make_checkerboard(SkBitmap* bitmap) {
+static void make_checkerboard(SkBitmap* bitmap) {
bitmap->allocN32Pixels(64, 64);
SkCanvas canvas(*bitmap);
SkPaint darkPaint;
@@ -55,10 +38,9 @@ protected:
canvas.restore();
}
}
- }
+}
- virtual void onDraw(SkCanvas* canvas) {
- canvas->clear(SK_ColorBLACK);
+DEF_SIMPLE_GM_BG(matriximagefilter, canvas, 420, 100, SK_ColorBLACK) {
SkMatrix matrix;
SkScalar margin = SkIntToScalar(10);
matrix.setSkew(SkDoubleToScalar(0.5), SkDoubleToScalar(0.2));
@@ -81,15 +63,4 @@ protected:
canvas->translate(srcRect.width() + margin, 0);
draw(canvas, srcRect, checkerboard, matrix, kHigh_SkFilterQuality);
#endif
- }
-
-private:
- typedef GM INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static GM* MyFactory(void*) { return new MatrixImageFilterGM; }
-static GMRegistry reg(MyFactory);
-
}
« no previous file with comments | « gm/linepaths.cpp ('k') | gm/mipmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698