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/gradient_matrix.cpp b/gm/gradient_matrix.cpp
index 7722759..8f665a1 100644
--- a/gm/gradient_matrix.cpp
+++ b/gm/gradient_matrix.cpp
@@ -111,25 +111,8 @@
canvas->restore();
}
-namespace skiagm {
-
-class GradientMatrixGM : public GM {
-public:
- GradientMatrixGM() {
- this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
- }
-
-protected:
-
- SkString onShortName() override {
- return SkString("gradient_matrix");
- }
-
- SkISize onISize() override {
- return SkISize::Make(800, 800);
- }
-
- void onDraw(SkCanvas* canvas) override {
+DEF_SIMPLE_GM_BG(gradient_matrix, canvas, 800, 800,
+ sk_tool_utils::color_to_565(0xFFDDDDDD)) {
draw_gradients(canvas, &make_linear_gradient,
linearPts, SK_ARRAY_COUNT(linearPts));
@@ -137,11 +120,4 @@
draw_gradients(canvas, &make_radial_gradient,
radialPts, SK_ARRAY_COUNT(radialPts));
- }
-
-private:
- typedef GM INHERITED;
-};
-
-DEF_GM( return new GradientMatrixGM; )
}