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/bigmatrix.cpp b/gm/bigmatrix.cpp
index c7c3b0d..2d2b7d9 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 @@
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);
-
}