aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/getpostextpath.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/getpostextpath.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/getpostextpath.cpp')
-rw-r--r--gm/getpostextpath.cpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/gm/getpostextpath.cpp b/gm/getpostextpath.cpp
index faace242e0..dcd983b3f3 100644
--- a/gm/getpostextpath.cpp
+++ b/gm/getpostextpath.cpp
@@ -12,27 +12,14 @@
#include "SkRandom.h"
#include "SkTemplates.h"
-class GetPosTextPathGM : public skiagm::GM {
-public:
- GetPosTextPathGM() {}
-
-protected:
-
- SkString onShortName() override {
- return SkString("getpostextpath");
- }
-
- SkISize onISize() override { return SkISize::Make(480, 780); }
-
- static void strokePath(SkCanvas* canvas, const SkPath& path) {
+static void strokePath(SkCanvas* canvas, const SkPath& path) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setColor(SK_ColorRED);
paint.setStyle(SkPaint::kStroke_Style);
canvas->drawPath(path, paint);
- }
-
- void onDraw(SkCanvas* canvas) override {
+}
+DEF_SIMPLE_GM(getpostextpath, canvas, 480, 780) {
// explicitly add spaces, to test a prev. bug
const char* text = "Ham bur ge fons";
int len = SkToInt(strlen(text));
@@ -67,10 +54,4 @@ protected:
canvas->drawPosText(text, len, &pos[0], paint);
paint.getPosTextPath(text, len, &pos[0], &path);
strokePath(canvas, path);
- }
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static skiagm::GM* F(void*) { return new GetPosTextPathGM; }
-static skiagm::GMRegistry gR(F);
+}