From 55d219429a5430eac7d568ee826339800b483dbb Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 29 Sep 2017 13:30:42 +0100 Subject: [PATCH] Don't reload background contrast effect on screen resize Summary: Similar to the Blur patch. Arguably rven less reason as this doesn't have a texture the size of the workspace. We don't need to delete and recreate the entire effect every time the screen changes; This deletes the wayland global which causes quite a bit of extra work for the clients. Test Plan: Changed resolution under X, and scale under wayland Panel looked the same and nothing exploded Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: graesslin, plasma-devel, kwin, #kwin Tags: #plasma Differential Revision: https://phabricator.kde.org/D7937 --- effects/backgroundcontrast/contrast.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/effects/backgroundcontrast/contrast.cpp b/effects/backgroundcontrast/contrast.cpp index a56b5f759c..3ef1cf1e0d 100644 --- a/effects/backgroundcontrast/contrast.cpp +++ b/effects/backgroundcontrast/contrast.cpp @@ -67,8 +67,9 @@ ContrastEffect::ContrastEffect() ); // Fetch the contrast regions for all windows - foreach (EffectWindow *window, effects->stackingOrder()) + for (EffectWindow *window: effects->stackingOrder()) { updateContrastRegion(window); + } } ContrastEffect::~ContrastEffect() @@ -78,7 +79,14 @@ ContrastEffect::~ContrastEffect() void ContrastEffect::slotScreenGeometryChanged() { - effects->reloadEffect(this); + effects->makeOpenGLContextCurrent(); + if (!supported()) { + effects->reloadEffect(this); + return; + } + for (EffectWindow *window: effects->stackingOrder()) { + updateContrastRegion(window); + } } void ContrastEffect::reconfigure(ReconfigureFlags flags)