allow GMs to animate

BUG=skia:

Review URL: https://codereview.chromium.org/888283002
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index dd771ce..5b8ed96 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -662,6 +662,19 @@
     return false;
 }
 
+bool SampleWindow::sendAnimatePulse() {
+    SkView* view = curr_view(this);
+    if (SampleView::IsSampleView(view)) {
+        if (fDoAnimate) {
+            return ((SampleView*)view)->animatePulse(gAnimTime, gAnimTimePrev);
+        } else {
+            // 0 signals the view that we are no longer animating
+            ((SampleView*)view)->animatePulse(0, 0);
+        }
+    }
+    return false;
+}
+
 void SampleWindow::setZoomCenter(float x, float y)
 {
     fZoomCenterX = x;
@@ -823,6 +836,7 @@
     fDeviceType = kANGLE_DeviceType;
 #endif
 
+    fDoAnimate = true;
     fUseClip = false;
     fNClip = false;
     fAnimating = false;
@@ -1130,6 +1144,10 @@
         this->postInvalDelay();
     }
 
+    if (this->sendAnimatePulse()) {
+        this->inval(NULL);
+    }
+
     // do this last
     fDevManager->publishCanvas(fDeviceType, canvas, this);
 }
@@ -1709,6 +1727,12 @@
     }
 
     switch (uni) {
+        case ' ':
+            fDoAnimate = !fDoAnimate;
+            if (this->sendAnimatePulse()) {
+                this->inval(NULL);
+            }
+            break;
         case 'B':
             post_event_to_sink(SkNEW_ARGS(SkEvent, ("PictFileView::toggleBBox")), curr_view(this));
             // Cannot call updateTitle() synchronously, because the toggleBBox event is still in