aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/patch.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/patch.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/patch.cpp')
-rw-r--r--gm/patch.cpp30
1 files changed, 1 insertions, 29 deletions
diff --git a/gm/patch.cpp b/gm/patch.cpp
index c3e43004a6..d9f6d57d6f 100644
--- a/gm/patch.cpp
+++ b/gm/patch.cpp
@@ -64,28 +64,7 @@ static void draw_control_points(SkCanvas* canvas, const SkPoint cubics[12]) {
canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, right + 1, paint);
}
-namespace skiagm {
-/**
- * This GM draws a cubics coons patch using the specialized call SkCanvas::drawPatch.
- */
-class SkPatchGM : public GM {
-
-public:
- SkPatchGM() {
- this->setBGColor(0xFFFFFFFF);
- }
-
-protected:
- SkString onShortName() override {
- return SkString("patch_primitive");
- }
-
- SkISize onISize() override {
- return SkISize::Make(800, 800);
- }
-
- void onDraw(SkCanvas* canvas) override {
-
+DEF_SIMPLE_GM(patch_primitive, canvas, 800, 800) {
SkPaint paint;
// The order of the colors and points is clockwise starting at upper-left corner.
@@ -148,11 +127,4 @@ protected:
}
}
canvas->restore();
- }
-
-private:
- typedef GM INHERITED;
-};
-
-DEF_GM(return new SkPatchGM;)
}