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/stroketext.cpp b/gm/stroketext.cpp
index 75ce164..d0a9882 100644
--- a/gm/stroketext.cpp
+++ b/gm/stroketext.cpp
@@ -59,28 +59,14 @@
draw_text_stroked(canvas, p, 10);
}
-class StrokeTextGM : public skiagm::GM {
- // Skia has a threshold above which it draws text via paths instead of using scalercontext
- // and caching the glyph. This GM wants to ensure that we draw stroking correctly on both
- // sides of this threshold.
+namespace {
enum {
kBelowThreshold_TextSize = 255,
kAboveThreshold_TextSize = 257
};
-public:
- StrokeTextGM() {}
+}
-protected:
-
- SkString onShortName() override {
- return SkString("stroketext");
- }
-
- SkISize onISize() override {
- return SkISize::Make(1200, 480);
- }
-
- void onDraw(SkCanvas* canvas) override {
+DEF_SIMPLE_GM(stroketext, canvas, 1200, 480) {
if (true) { test_nulldev(canvas); }
SkPaint paint;
paint.setAntiAlias(true);
@@ -92,10 +78,4 @@
canvas->translate(600, 0);
paint.setTextSize(kAboveThreshold_TextSize);
draw_text_set(canvas, paint);
- }
-
-private:
- typedef skiagm::GM INHERITED;
-};
-
-DEF_GM(return new StrokeTextGM;)
+}