rational: implement NaN mode
Also clarify code where 0 is used as a rational.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ class PlaybackCache : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
PlaybackCache(QObject* parent = nullptr) :
|
||||
QObject(parent)
|
||||
QObject(parent),
|
||||
length_(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user