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/SampleCamera.cpp b/samplecode/SampleCamera.cpp
index 3ad7455..38201eb 100644
--- a/samplecode/SampleCamera.cpp
+++ b/samplecode/SampleCamera.cpp
@@ -13,7 +13,7 @@
#include "samplecode/Sample.h"
#include "src/effects/SkEmbossMaskFilter.h"
#include "tools/Resources.h"
-#include "tools/timer/AnimTimer.h"
+#include "tools/timer/TimeUtils.h"
namespace {
class CameraView : public Sample {
@@ -67,12 +67,8 @@
}
}
- bool onAnimate(const AnimTimer& timer) override {
- if (timer.isStopped()) {
- fRY = 0;
- } else {
- fRY = timer.scaled(90, 360);
- }
+ bool onAnimate(double nanos) override {
+ fRY = nanos ? TimeUtils::Scaled(1e-9 * nanos, 90, 360) : 0;
return true;
}
};