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/samplecode/SampleCusp.cpp b/samplecode/SampleCusp.cpp
index f8ff078..28b1233 100644
--- a/samplecode/SampleCusp.cpp
+++ b/samplecode/SampleCusp.cpp
@@ -11,7 +11,7 @@
#include "include/core/SkPath.h"
#include "samplecode/Sample.h"
#include "src/core/SkGeometry.h"
-#include "tools/timer/AnimTimer.h"
+#include "tools/timer/TimeUtils.h"
// This draws an animation where every cubic has a cusp, to test drawing a circle
// at the cusp point. Create a unit square. A cubic with its control points
@@ -165,8 +165,8 @@
SkDebugf("");
}
- bool onAnimate(const AnimTimer& timer) override {
- curTime = timer.msec();
+ bool onAnimate(double nanos) override {
+ curTime = TimeUtils::NanosToMSec(nanos);
if (!start) {
start = curTime;
}