tools: separate TimeUtils from AnimTimer
gm, slides, and samples no longer need to know about the implementation
details of AnimTimer.
This
virtual bool onAnimate(const AnimTimer&);
becomes this:
virtual bool onAnimate(double /*nanoseconds*/);
which is much easier to reason about.
AnimTimer itself is now part of viewer.
Change-Id: Ib70bf7a0798b1991f25204ae84f70463cdbeb358
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226838
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index b45c65b..607d6f4 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -1952,7 +1952,7 @@
}
if (ImGui::CollapsingHeader("Animation")) {
- bool isPaused = fAnimTimer.isPaused();
+ bool isPaused = AnimTimer::kPaused_State == fAnimTimer.state();
if (ImGui::Checkbox("Pause", &isPaused)) {
fAnimTimer.togglePauseResume();
}
@@ -2154,7 +2154,7 @@
fStatsLayer.beginTiming(fAnimateTimer);
fAnimTimer.updateTime();
- bool animateWantsInval = fSlides[fCurrentSlide]->animate(fAnimTimer);
+ bool animateWantsInval = fSlides[fCurrentSlide]->animate(fAnimTimer.nanos());
fStatsLayer.endTiming(fAnimateTimer);
ImGuiIO& io = ImGui::GetIO();