block: fixed buggy cache invalidation behavior when resizing blocks

This commit is contained in:
itsmattkc
2020-06-01 17:39:08 +10:00
parent 001b7179c5
commit 644fb7cec8
3 changed files with 19 additions and 18 deletions
+4 -12
View File
@@ -82,23 +82,15 @@ void ClipBlock::LengthChangedEvent(const rational &old_length, const rational &n
void ClipBlock::InvalidateCache(const TimeRange &range, NodeInput *from, NodeInput *source)
{
// If signal is from texture input, transform all times from media time to sequence time
if (from == texture_input_ || from == media_in_input()) {
if (from == texture_input_) {
// Adjust range from media time to sequence time
rational start = MediaToSequenceTime(range.in());
rational end = MediaToSequenceTime(range.out());
// Ensure range actually covers this clip's area
if (!(end < in() || start > out())) {
// Limit cache invalidation to clip lengths
start = qMax(start, in());
end = qMin(end, out());
Node::InvalidateCache(TimeRange(start, end), from, source);
}
Block::InvalidateCache(TimeRange(start, end), from, source);
} else {
// Otherwise, pass signal along normally
Node::InvalidateCache(range, from, source);
Block::InvalidateCache(range, from, source);
}
}