diff --git a/src/libkwineffects/kwineffects.cpp b/src/libkwineffects/kwineffects.cpp index 56299aea9a..825e127afb 100644 --- a/src/libkwineffects/kwineffects.cpp +++ b/src/libkwineffects/kwineffects.cpp @@ -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) diff --git a/src/libkwineffects/kwinoffscreeneffect.cpp b/src/libkwineffects/kwinoffscreeneffect.cpp index 6ee3092dc0..5353f73d18 100644 --- a/src/libkwineffects/kwinoffscreeneffect.cpp +++ b/src/libkwineffects/kwinoffscreeneffect.cpp @@ -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();