make pathiter bench a little more realistic

Touch the memory that the iterator returns, so we're (slightly) more
sure the compiler isn't eliding code we want to be timing.

Change-Id: I62eb36759413d83fb18f4a6e0bf23d4d98f11999
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235860
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/bench/PathIterBench.cpp b/bench/PathIterBench.cpp
index c16e431..d5f3d38 100644
--- a/bench/PathIterBench.cpp
+++ b/bench/PathIterBench.cpp
@@ -40,6 +40,9 @@
     SkPath          fPath;
     PathIterType    fType;
 
+    int fVerbInc = 0;
+    SkScalar fXInc = 0, fYInc = 0;
+
 public:
     PathIterBench(PathIterType t) : fType(t) {
         fName.printf("pathiter_%s", gPathIterNames[static_cast<unsigned>(t)]);
@@ -75,25 +78,39 @@
     }
 
     void onDraw(int loops, SkCanvas*) override {
+        // Need to do *something* with the results, so the compile doesn't elide
+        // away the code we want to time.
+        auto handle = [this](int verb, const SkPoint pts[]) {
+            fVerbInc += verb;
+            fXInc += pts[0].fX;
+            fYInc += pts[0].fY;
+        };
+
         SkPath::Verb verb;
         SkPoint      pts[4];
         switch (fType) {
             case PathIterType::kIter:
                 for (int i = 0; i < loops; ++i) {
                     SkPath::Iter iter(fPath, true);
-                    while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { }
+                    while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
+                        handle(verb, pts);
+                    }
                 }
                 break;
             case PathIterType::kRaw:
                 for (int i = 0; i < loops; ++i) {
                     SkPath::RawIter iter(fPath);
-                    while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { }
+                    while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
+                        handle(verb, pts);
+                    }
                 }
                 break;
             case PathIterType::kEdge:
                 for (int i = 0; i < loops; ++i) {
                     SkPathEdgeIter iter(fPath);
-                    while (iter.next()) { }
+                    while (auto r = iter.next()) {
+                        handle((int)r.fEdge, r.fPts);
+                    }
                 }
                 break;
         }