From 66125caac32f75f0fafcfa6ff64fe369de02289d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Fri, 11 Jun 2010 18:38:54 +0000 Subject: [PATCH] Fix the darkening of the bottom-most pixels behind the plasma panel. The texture needs to be drawn on screen coordinates on the offscreen framebuffer in the horizontal pass, otherwise pixels that fall below the screen won't be clamped to the screen edge in the subsequent vertical pass. This is because the offscreen buffer is the same size as the screen. This change also gets rid of the need to clear the offscreen buffer before blurring the screen contents behind each window, and reduces the CPU computations done on the blur region. svn path=/trunk/KDE/kdebase/workspace/; revision=1137134 --- effects/blur/blur.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp index 924c104079..f878f8b915 100644 --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -227,8 +227,6 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai { const QRegion expanded = expand(shape) & screen; const QRect r = expanded.boundingRect(); - const QPoint offset = -shape.boundingRect().topLeft() + - (shape.boundingRect().topLeft() - r.topLeft()); // Create a scratch texture and copy the area in the back buffer that we're // going to blur into it @@ -242,20 +240,20 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai // Draw the texture on the offscreen framebuffer object, while blurring it horizontally effects->pushRenderTarget(target); - glClear(GL_COLOR_BUFFER_BIT); shader->bind(); shader->setDirection(Qt::Horizontal); shader->setPixelDistance(1.0 / r.width()); - // Set up the texture matrix to normalize the coordinates + // Set up the texture matrix to transform from screen coordinates + // to texture coordinates. glMatrixMode(GL_TEXTURE); glPushMatrix(); glLoadIdentity(); glScalef(1.0 / scratch.width(), -1.0 / scratch.height(), 1); - glTranslatef(0, -scratch.height(), 0); + glTranslatef(-r.x(), -scratch.height() - r.y(), 0); - drawRegion(expanded.translated(-r.topLeft())); + drawRegion(expanded); effects->popRenderTarget(); scratch.unbind(); @@ -281,7 +279,7 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai // to texture coordinates. glLoadIdentity(); glScalef(1.0 / tex->width(), -1.0 / tex->height(), 1); - glTranslatef(offset.x(), -tex->height() + offset.y(), 0); + glTranslatef(0, -tex->height(), 0); drawRegion(shape);