From 2a24338c777462e04a2b26295f9c034155ee8f3e Mon Sep 17 00:00:00 2001 From: halcanary Date: Wed, 9 Sep 2015 08:16:41 -0700 Subject: 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 --- gm/texteffects.cpp | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'gm/texteffects.cpp') diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp index 902bed3ea8..53395f0732 100644 --- a/gm/texteffects.cpp +++ b/gm/texteffects.cpp @@ -170,20 +170,7 @@ static void apply_shader(SkPaint* paint, int index) { paint->setColor(SK_ColorBLUE); } -class TextEffectsGM : public skiagm::GM { -public: - TextEffectsGM() {} - -protected: - SkString onShortName() override { - return SkString("texteffects"); - } - - SkISize onISize() override { - return SkISize::Make(460, 680); - } - - void onDraw(SkCanvas* canvas) override { +DEF_SIMPLE_GM(texteffects, canvas, 460, 680) { canvas->save(); SkPaint paint; @@ -208,13 +195,4 @@ protected: } canvas->restore(); - } - -private: - typedef skiagm::GM INHERITED; -}; - -////////////////////////////////////////////////////////////////////////////// - -static skiagm::GM* MyFactory(void*) { return new TextEffectsGM; } -static skiagm::GMRegistry reg(MyFactory); +} -- cgit v1.2.3