Fix scripted shader effect animations

AnimationEffect inherits from CrossfadeEffect as it may do a crossfade,
but it also has to perform non-crossfading activities with a custom
shader.

For crossfades we want to draw the old and new window, but this isn't
needed where the crossFadeProgress remains at 0.

BUG: 460277
This commit is contained in:
David Edmundson 2022-10-12 11:28:25 +00:00
parent 4d0f8e417c
commit 36440a9d91
2 changed files with 11 additions and 6 deletions

View file

@ -251,7 +251,7 @@ WindowPaintData::WindowPaintData(const QMatrix4x4 &screenProjectionMatrix)
setSaturation(1.0);
setBrightness(1.0);
setScreen(0);
setCrossFadeProgress(1.0);
setCrossFadeProgress(0.0);
}
WindowPaintData::WindowPaintData(const WindowPaintData &other)

View file

@ -280,16 +280,21 @@ void CrossFadeEffect::drawWindow(EffectWindow *window, int mask, const QRegion &
{
Q_UNUSED(mask)
CrossFadeWindowData *offscreenData = d->windows.value(window);
// paint the new window (if applicable) underneath
Effect::drawWindow(window, mask, region, data);
if (data.crossFadeProgress() > 0 || !offscreenData) {
Effect::drawWindow(window, mask, region, data);
}
if (!offscreenData) {
return;
}
// paint old snapshot on top
WindowPaintData previousWindowData = data;
previousWindowData.setOpacity((1.0 - data.crossFadeProgress()) * data.opacity());
CrossFadeWindowData *offscreenData = d->windows[window];
if (!offscreenData) {
return;
}
const QRectF expandedGeometry = window->expandedGeometry();
const QRectF frameGeometry = window->frameGeometry();