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/bigmatrix.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/bigmatrix.cpp')
-rw-r--r-- | gm/bigmatrix.cpp | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/gm/bigmatrix.cpp b/gm/bigmatrix.cpp index c7c3b0dd07..2d2b7d9f7e 100644 --- a/gm/bigmatrix.cpp +++ b/gm/bigmatrix.cpp @@ -11,24 +11,8 @@ #include "SkPath.h" #include "SkShader.h" -namespace skiagm { - -class BigMatrixGM : public GM { -public: - BigMatrixGM() { - this->setBGColor(sk_tool_utils::color_to_565(0xFF66AA99)); - } - -protected: - virtual SkString onShortName() { - return SkString("bigmatrix"); - } - - virtual SkISize onISize() { - return SkISize::Make(50, 50); - } - - virtual void onDraw(SkCanvas* canvas) { +DEF_SIMPLE_GM_BG(bigmatrix, canvas, 50, 50, + sk_tool_utils::color_to_565(0xFF66AA99)) { SkMatrix m; m.reset(); m.setRotate(33 * SK_Scalar1); @@ -82,15 +66,4 @@ protected: rect.setLTRB(pt.fX - small, pt.fY - small, pt.fX + small, pt.fY + small); canvas->drawRect(rect, paint); - } - -private: - typedef GM INHERITED; -}; - -////////////////////////////////////////////////////////////////////////////// - -static GM* MyFactory(void*) { return new BigMatrixGM; } -static GMRegistry reg(MyFactory); - } |