Paste P105

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Sep 15 2017, 10:17 AM.
diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp
index ae9f37326..144934462 100644
--- a/effects/blur/blur.cpp
+++ b/effects/blur/blur.cpp
@@ -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.
@@ -83,6 +76,7 @@ BlurEffect::~BlurEffect()
{
windows.clear();
+ qDebug() << "deleting blur mangler";
delete m_simpleShader;
delete shader;
delete target;
@@ -90,7 +84,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)
@@ -108,6 +118,7 @@ void BlurEffect::reconfigure(ReconfigureFlags flags)
if (!shader || !shader->isValid()) {
effects->removeSupportProperty(s_blurAtomName, this);
+ qDebug() << "deleting blur mangler2" << shader;
delete m_blurManager;
m_blurManager = nullptr;
}
diff --git a/effects/blur/blur.h b/effects/blur/blur.h
index e6f44946d..85a7b4ae6 100644
--- a/effects/blur/blur.h
+++ b/effects/blur/blur.h
@@ -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)
davidedmundson edited the content of this paste. (Show Details)Sep 15 2017, 10:17 AM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.
davidedmundson updated the paste's language from autodetect to autodetect.