track: cache length change invalidations and release when not dragging

Not sure if this is the best solution, we'll see. Fixes issue
where cache wouldn't respond to length slider.
This commit is contained in:
itsmattkc
2021-04-17 12:50:58 +10:00
parent 824b87c9d4
commit 1a848dc440
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -672,6 +672,17 @@ void Track::BlockLengthChanged()
TimeRange invalidate_region(qMin(old_out, new_out), track_length());
// The cache won't start while dragging, so we store up our invalidations if it's held down
// and release them once the mouse is no longer pressed
if (qApp->mouseButtons() & Qt::LeftButton) {
block_length_pending_invalidations_.insert(invalidate_region);
} else if (!block_length_pending_invalidations_.isEmpty()) {
foreach (const TimeRange& r, block_length_pending_invalidations_) {
Node::InvalidateCache(r, kBlockInput);
}
block_length_pending_invalidations_.clear();
}
Node::InvalidateCache(invalidate_region, kBlockInput);
}
+2
View File
@@ -422,6 +422,8 @@ private:
void SetLengthInternal(const rational& r, bool invalidate = true);
TimeRangeList block_length_pending_invalidations_;
QVector<Block*> blocks_;
QVector<int> block_array_indexes_;