rational: implement NaN mode

Also clarify code where 0 is used as a rational.
This commit is contained in:
itsmattkc
2021-04-17 15:04:03 +10:00
parent 88ebfb9d8e
commit 22b2d08baf
13 changed files with 132 additions and 108 deletions
+6 -4
View File
@@ -322,7 +322,7 @@ void FrameHashCache::ShiftEvent(const rational &from, const rational &to)
// POSITIVE if moving forward ->
// NEGATIVE if moving backward <-
rational diff = to - from;
bool diff_is_negative = (diff < rational());
bool diff_is_negative = (diff < 0);
QList<HashTimePair> shifted_times;
@@ -353,10 +353,12 @@ void FrameHashCache::ShiftEvent(const rational &from, const rational &to)
void FrameHashCache::InvalidateEvent(const TimeRange &range)
{
QVector<rational> invalid_frames = GetFrameListFromTimeRange({range});
if (!timebase_.isNull()) {
QVector<rational> invalid_frames = GetFrameListFromTimeRange({range});
foreach (const rational& r, invalid_frames) {
time_hash_map_.remove(r);
foreach (const rational& r, invalid_frames) {
time_hash_map_.remove(r);
}
}
}
+2 -1
View File
@@ -35,7 +35,8 @@ class PlaybackCache : public QObject
Q_OBJECT
public:
PlaybackCache(QObject* parent = nullptr) :
QObject(parent)
QObject(parent),
length_(0)
{
}
+1 -2
View File
@@ -18,8 +18,7 @@ PreviewAutoCacher::PreviewAutoCacher() :
last_update_time_(0),
ignore_next_mouse_button_(false)
{
// Set default autocache range
SetPlayhead(rational());
SetPlayhead(0);
delayed_requeue_timer_.setInterval(Config::Current()[QStringLiteral("AutoCacheDelay")].toInt());
delayed_requeue_timer_.setSingleShot(true);