GM: replace boilerplate with macros
I have verified locally that nothing draws differently.
Motivation:
* SK_SIMPLE_GM makes it easier to write a GM.
* Reducing 1100 lines of code makes maintenance easier.
* Simple GMs are easy to convert to Fiddles.
Review URL: https://codereview.chromium.org/1333553002
diff --git a/gm/imagemagnifier.cpp b/gm/imagemagnifier.cpp
index 2bf2226..7363981 100644
--- a/gm/imagemagnifier.cpp
+++ b/gm/imagemagnifier.cpp
@@ -12,25 +12,7 @@
#define WIDTH 500
#define HEIGHT 500
-namespace skiagm {
-
-class ImageMagnifierGM : public GM {
-public:
- ImageMagnifierGM() {
- this->setBGColor(0xFF000000);
- }
-
-protected:
-
- SkString onShortName() override {
- return SkString("imagemagnifier");
- }
-
- SkISize onISize() override {
- return SkISize::Make(WIDTH, HEIGHT);
- }
-
- void onDraw(SkCanvas* canvas) override {
+DEF_SIMPLE_GM_BG(imagemagnifier, canvas, WIDTH, HEIGHT, SK_ColorBLACK) {
SkPaint filterPaint;
filterPaint.setImageFilter(
SkMagnifierImageFilter::Create(
@@ -53,15 +35,4 @@
SkIntToScalar(y), paint);
}
canvas->restore();
- }
-
-private:
- typedef GM INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static GM* MyFactory(void*) { return new ImageMagnifierGM; }
-static GMRegistry reg(MyFactory);
-
}