Add some !isnan Assert-s in the animations engine.
This commit is contained in:
parent
f2c77daccc
commit
6956514425
1 changed files with 13 additions and 1 deletions
|
|
@ -337,14 +337,21 @@ inline void Simple::start(
|
||||||
that = _data.get(),
|
that = _data.get(),
|
||||||
callback = Prepare(std::forward<Callback>(callback))
|
callback = Prepare(std::forward<Callback>(callback))
|
||||||
](crl::time now) {
|
](crl::time now) {
|
||||||
|
Assert(!std::isnan(double(now - that->animation.started())));
|
||||||
const auto time = anim::Disabled()
|
const auto time = anim::Disabled()
|
||||||
? that->duration
|
? that->duration
|
||||||
: (now - that->animation.started());
|
: (now - that->animation.started());
|
||||||
|
Assert(!std::isnan(time));
|
||||||
|
Assert(!std::isnan(that->delta));
|
||||||
|
Assert(!std::isnan(that->duration));
|
||||||
const auto finished = (time >= that->duration);
|
const auto finished = (time >= that->duration);
|
||||||
const auto progress = finished
|
const auto progress = finished
|
||||||
? that->delta
|
? that->delta
|
||||||
: that->transition(that->delta, time / that->duration);
|
: that->transition(that->delta, time / that->duration);
|
||||||
|
Assert(!std::isnan(that->from));
|
||||||
|
Assert(!std::isnan(progress));
|
||||||
that->value = that->from + progress;
|
that->value = that->from + progress;
|
||||||
|
Assert(!std::isnan(that->value));
|
||||||
|
|
||||||
if (finished) {
|
if (finished) {
|
||||||
that->animation.stop();
|
that->animation.stop();
|
||||||
|
|
@ -401,7 +408,12 @@ inline bool Simple::animating() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
TG_FORCE_INLINE float64 Simple::value(float64 final) const {
|
TG_FORCE_INLINE float64 Simple::value(float64 final) const {
|
||||||
return animating() ? _data->value : final;
|
if (animating()) {
|
||||||
|
Assert(!std::isnan(_data->value));
|
||||||
|
return _data->value;
|
||||||
|
}
|
||||||
|
Assert(!std::isnan(final));
|
||||||
|
return final;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Simple::startPrepared(
|
inline void Simple::startPrepared(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue