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); |
- |
} |