aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/gradient_matrix.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-09-09 08:16:41 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-09 08:16:41 -0700
commit2a24338c777462e04a2b26295f9c034155ee8f3e (patch)
treecab82add826f6d77e75c8265ea960f16929033a8 /gm/gradient_matrix.cpp
parent157e6483fb089bf4d2e5cd2c18b521e5ab4ff32a (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/gradient_matrix.cpp')
-rw-r--r--gm/gradient_matrix.cpp28
1 files changed, 2 insertions, 26 deletions
diff --git a/gm/gradient_matrix.cpp b/gm/gradient_matrix.cpp
index 77227599e6..8f665a1b94 100644
--- a/gm/gradient_matrix.cpp
+++ b/gm/gradient_matrix.cpp
@@ -111,25 +111,8 @@ static void draw_gradients(SkCanvas* canvas,
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 @@ protected:
draw_gradients(canvas, &make_radial_gradient,
radialPts, SK_ARRAY_COUNT(radialPts));
- }
-
-private:
- typedef GM INHERITED;
-};
-
-DEF_GM( return new GradientMatrixGM; )
}