effects/morphingpopups: Fix glitch

There's a visual glitch that looks like a random rectangle in the top
left corner of morphing popup. It appears like it's caused by the blur
effect, it produces wrong results when the window is captured in
CrossFadeEffect::redirect().

Make CrossFadeEffect::redirect() unset blur and contrast force roles, so
the backdrop effects are not included in the captured frame.
This commit is contained in:
Vlad Zahorodnii 2023-01-13 14:13:11 +02:00
parent d32f8df7c8
commit dedae9e667

View file

@ -350,9 +350,20 @@ void CrossFadeEffect::redirect(EffectWindow *window)
} }
offscreenData = std::make_unique<CrossFadeWindowData>(); offscreenData = std::make_unique<CrossFadeWindowData>();
// Avoid including blur and contrast effects. During a normal painting cycle they
// won't be included, but since we call effects->drawWindow() outside usual compositing
// cycle, we have to prevent backdrop effects kicking in.
const QVariant blurRole = window->data(WindowForceBlurRole);
window->setData(WindowForceBlurRole, QVariant());
const QVariant contrastRole = window->data(WindowForceBackgroundContrastRole);
window->setData(WindowForceBackgroundContrastRole, QVariant());
effects->makeOpenGLContextCurrent(); effects->makeOpenGLContextCurrent();
offscreenData->maybeRender(window); offscreenData->maybeRender(window);
offscreenData->frameGeometryAtCapture = window->frameGeometry(); offscreenData->frameGeometryAtCapture = window->frameGeometry();
window->setData(WindowForceBlurRole, blurRole);
window->setData(WindowForceBackgroundContrastRole, contrastRole);
} }
void CrossFadeEffect::unredirect(EffectWindow *window) void CrossFadeEffect::unredirect(EffectWindow *window)