Commit 3f525277 authored by Martin Flöser's avatar Martin Flöser
Browse files

Recreate lanczos filter whenever the screen size changes

The LanczosFilter has a FBO in screen size. When the screen
geometry changes this FBO has to be recreated. To go completely
sure the lanczos filter gets deleted on screen changes.

To achieve this the LanczosFilter is wrapped inside a
QWeakPointer so that we can track when it got deleted. This
brings an additional advantage by delaying the creation of the
shader till it is really needed, that is when for the first
time a window thumbnail with lanczos is rendered.

BUG: 296065
FIXED-IN: 4.9.0
REVIEW: 105479
parent 40284b3c
......@@ -75,6 +75,7 @@ along with this program. If not, see <>.
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QDesktopWidget>
#include "client.h"
#include "deleted.h"
......@@ -98,7 +99,6 @@ Scene::Scene(Workspace* ws)
: QObject(ws)
, wspace(ws)
, has_waitSync(false)
, lanczos_filter(new LanczosFilter())
, m_overlayWindow(new OverlayWindow())
last_time.invalidate(); // Initialize the timer
......@@ -106,7 +106,6 @@ Scene::Scene(Workspace* ws)
delete lanczos_filter;
delete m_overlayWindow;
......@@ -435,9 +434,15 @@ void Scene::finalPaintWindow(EffectWindowImpl* w, int mask, QRegion region, Wind
// will be eventually called from drawWindow()
void Scene::finalDrawWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data)
lanczos_filter->performPaint(w, mask, region, data);
if (lanczos_filter.isNull()) {
lanczos_filter = new LanczosFilter(this);
// recreate the lanczos filter when the screen gets resized
connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)),, SLOT(deleteLater()));
connect(QApplication::desktop(), SIGNAL(resized(int)),, SLOT(deleteLater()));
}>performPaint(w, mask, region, data);
} else
w->sceneWindow()->performPaint(mask, region, data);
......@@ -154,7 +154,7 @@ protected:
QElapsedTimer last_time;
Workspace* wspace;
bool has_waitSync;
LanczosFilter* lanczos_filter;
QWeakPointer<LanczosFilter> lanczos_filter;
OverlayWindow* m_overlayWindow;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment