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/SampleThinAA.cpp b/samplecode/SampleThinAA.cpp
index ae301e9..92aa202 100644
--- a/samplecode/SampleThinAA.cpp
+++ b/samplecode/SampleThinAA.cpp
@@ -13,7 +13,6 @@
#include "include/core/SkImage.h"
#include "include/core/SkPath.h"
#include "include/core/SkSurface.h"
-#include "tools/timer/AnimTimer.h"
namespace skiagm {
@@ -316,8 +315,8 @@
this->drawShapes(canvas, "SSx64", 4, fSS16);
}
- bool onAnimate(const AnimTimer& timer) override {
- SkScalar t = timer.secs();
+ bool onAnimate(double nanos) override {
+ SkScalar t = 1e-9 * nanos;
SkScalar dt = fLastFrameTime < 0.f ? 0.f : t - fLastFrameTime;
fLastFrameTime = t;