gm: add some overrides

Change-Id: I5348e2da1a2034b629d43b9e9faadb6db333abe8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228348
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/gm/emptypath.cpp b/gm/emptypath.cpp
index d3a6a13..126db9e 100644
--- a/gm/emptypath.cpp
+++ b/gm/emptypath.cpp
@@ -24,15 +24,9 @@
 namespace skiagm {
 
 class EmptyPathGM : public GM {
-public:
-    EmptyPathGM() {}
+    SkString onShortName() override { return SkString("emptypath"); }
 
-protected:
-    SkString onShortName() {
-        return SkString("emptypath");
-    }
-
-    SkISize onISize() { return SkISize::Make(600, 280); }
+    SkISize onISize() override { return {600, 280}; }
 
     void drawEmpty(SkCanvas* canvas,
                     SkColor color,
@@ -50,7 +44,7 @@
         canvas->restore();
     }
 
-    virtual void onDraw(SkCanvas* canvas) {
+    void onDraw(SkCanvas* canvas) override {
         struct FillAndName {
             SkPath::FillType fFill;
             const char*      fName;
@@ -119,61 +113,51 @@
         canvas->restore();
         canvas->restore();
     }
-
-private:
-    typedef GM INHERITED;
 };
 DEF_GM( return new EmptyPathGM; )
 
 //////////////////////////////////////////////////////////////////////////////
 
-static void make_path_move(SkPath* path, const SkPoint pts[3]) {
-    for (int i = 0; i < 3; ++i) {
-        path->moveTo(pts[i]);
+static constexpr int kPtsCount = 3;
+static constexpr SkPoint kPts[kPtsCount] = {
+    {40, 40},
+    {80, 40},
+    {120, 40},
+};
+
+static void make_path_move(SkPath* path) {
+    for (SkPoint p : kPts) {
+        path->moveTo(p);
     }
 }
 
-static void make_path_move_close(SkPath* path, const SkPoint pts[3]) {
-    for (int i = 0; i < 3; ++i) {
-        path->moveTo(pts[i]);
+static void make_path_move_close(SkPath* path) {
+    for (SkPoint p : kPts) {
+        path->moveTo(p);
         path->close();
     }
 }
 
-static void make_path_move_line(SkPath* path, const SkPoint pts[3]) {
-    for (int i = 0; i < 3; ++i) {
-        path->moveTo(pts[i]);
-        path->lineTo(pts[i]);
+static void make_path_move_line(SkPath* path) {
+    for (SkPoint p : kPts) {
+        path->moveTo(p);
+        path->lineTo(p);
     }
 }
 
-typedef void (*MakePathProc)(SkPath*, const SkPoint pts[3]);
-
-static void make_path_move_mix(SkPath* path, const SkPoint pts[3]) {
-    path->moveTo(pts[0]);
-    path->moveTo(pts[1]); path->close();
-    path->moveTo(pts[2]); path->lineTo(pts[2]);
+static void make_path_move_mix(SkPath* path) {
+    path->moveTo(kPts[0]);
+    path->moveTo(kPts[1]); path->close();
+    path->moveTo(kPts[2]); path->lineTo(kPts[2]);
 }
 
 class EmptyStrokeGM : public GM {
-    SkPoint fPts[3];
+    SkString onShortName() override { return SkString("emptystroke"); }
 
-public:
-    EmptyStrokeGM() {
-        fPts[0].set(40, 40);
-        fPts[1].set(80, 40);
-        fPts[2].set(120, 40);
-    }
-
-protected:
-    SkString onShortName() override {
-        return SkString("emptystroke");
-    }
-
-    SkISize onISize() override { return SkISize::Make(200, 240); }
+    SkISize onISize() override { return {200, 240}; }
 
     void onDraw(SkCanvas* canvas) override {
-        const MakePathProc procs[] = {
+        static constexpr void (*kProcs[])(SkPath*) = {
             make_path_move,             // expect red red red
             make_path_move_close,       // expect black black black
             make_path_move_line,        // expect black black black
@@ -190,17 +174,14 @@
         strokePaint.setStyle(SkPaint::kStroke_Style);
         dotPaint.setStrokeWidth(7);
 
-        for (size_t i = 0; i < SK_ARRAY_COUNT(procs); ++i) {
+        for (auto proc : kProcs) {
             SkPath path;
-            procs[i](&path, fPts);
-            canvas->drawPoints(SkCanvas::kPoints_PointMode, 3, fPts, dotPaint);
+            proc(&path);
+            canvas->drawPoints(SkCanvas::kPoints_PointMode, kPtsCount, kPts, dotPaint);
             canvas->drawPath(path, strokePaint);
             canvas->translate(0, 40);
         }
     }
-
-private:
-    typedef GM INHERITED;
 };
 DEF_GM( return new EmptyStrokeGM; )