Merge branch 'Plasma/5.11'

This commit is contained in:
David Edmundson 2017-09-29 13:31:48 +01:00
commit 2a34fdde4c
3 changed files with 30 additions and 12 deletions

View file

@ -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)

View file

@ -46,14 +46,7 @@ BlurEffect::BlurEffect()
qCDebug(KWINEFFECTS) << "Simple blur shader failed to load";
}
// Offscreen texture that's used as the target for the horizontal blur pass
// and the source for the vertical pass.
tex = GLTexture(GL_RGBA8, effects->virtualScreenSize());
tex.setFilter(GL_LINEAR);
tex.setWrapMode(GL_CLAMP_TO_EDGE);
target = new GLRenderTarget(tex);
updateTexture();
reconfigure(ReconfigureAll);
// ### Hackish way to announce support.
@ -97,7 +90,23 @@ BlurEffect::~BlurEffect()
void BlurEffect::slotScreenGeometryChanged()
{
effects->reloadEffect(this);
effects->makeOpenGLContextCurrent();
updateTexture();
// Fetch the blur regions for all windows
foreach (EffectWindow *window, effects->stackingOrder())
updateBlurRegion(window);
effects->doneOpenGLContextCurrent();
}
void BlurEffect::updateTexture() {
delete target;
// Offscreen texture that's used as the target for the horizontal blur pass
// and the source for the vertical pass.
tex = GLTexture(GL_RGBA8, effects->virtualScreenSize());
tex.setFilter(GL_LINEAR);
tex.setWrapMode(GL_CLAMP_TO_EDGE);
target = new GLRenderTarget(tex);
}
void BlurEffect::reconfigure(ReconfigureFlags flags)

View file

@ -76,6 +76,7 @@ public Q_SLOTS:
void slotScreenGeometryChanged();
private:
void updateTexture();
QRect expand(const QRect &rect) const;
QRegion expand(const QRegion &region) const;
QRegion blurRegion(const EffectWindow *w) const;
@ -90,7 +91,7 @@ private:
private:
BlurShader *shader;
GLShader *m_simpleShader;
GLRenderTarget *target;
GLRenderTarget *target = nullptr;
GLTexture tex;
long net_wm_blur_region;
QRegion m_damagedArea; // keeps track of the area which has been damaged (from bottom to top)