diff options
author | halcanary <halcanary@google.com> | 2015-09-09 08:16:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-09 08:16:41 -0700 |
commit | 2a24338c777462e04a2b26295f9c034155ee8f3e (patch) | |
tree | cab82add826f6d77e75c8265ea960f16929033a8 /gm/pathreverse.cpp | |
parent | 157e6483fb089bf4d2e5cd2c18b521e5ab4ff32a (diff) |
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
Diffstat (limited to 'gm/pathreverse.cpp')
-rw-r--r-- | gm/pathreverse.cpp | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/gm/pathreverse.cpp b/gm/pathreverse.cpp index 4487f9ada2..33507650a2 100644 --- a/gm/pathreverse.cpp +++ b/gm/pathreverse.cpp @@ -68,25 +68,8 @@ static void test_rev(SkCanvas* canvas, const SkPath& path) { canvas->restore(); } -namespace skiagm { - -class PathReverseGM : public GM { -public: - PathReverseGM() { - - } - -protected: - - SkString onShortName() override { - return SkString("path-reverse"); - } - - SkISize onISize() override { - return SkISize::Make(640, 480); - } - - void onDraw(SkCanvas* canvas) override { +DEF_SIMPLE_GM_BG_NAME(pathreverse, canvas, 640, 480, SK_ColorWHITE, + SkString("path-reverse")) { SkRect r = { 10, 10, 100, 60 }; SkPath path; @@ -108,15 +91,4 @@ protected: path = hiragino_maru_goth_pro_e(); canvas->translate(0, 100); test_rev(canvas, path); - } - -private: - typedef GM INHERITED; -}; - -////////////////////////////////////////////////////////////////////////////// - -static GM* MyFactory(void*) { return new PathReverseGM; } -static GMRegistry reg(MyFactory); - } |