Blur background of EffectFrames.
BUG: 241389 FIXED-IN: 4.6.0 svn path=/trunk/KDE/kdebase/workspace/; revision=1154132
This commit is contained in:
parent
89c0ea0c8d
commit
111db93e05
2 changed files with 83 additions and 66 deletions
|
@ -229,6 +229,30 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai
|
|||
shape = blurRegion(w).translated(w->geometry().topLeft()) & screen;
|
||||
|
||||
if (valid && !shape.isEmpty() && region.intersects(shape.boundingRect()))
|
||||
{
|
||||
doBlur(shape, screen, data.opacity * data.contents_opacity);
|
||||
|
||||
// Rebind the shader used for drawing the window if one was set
|
||||
if (data.shader)
|
||||
data.shader->bind();
|
||||
}
|
||||
|
||||
// Draw the window over the blurred area
|
||||
effects->drawWindow(w, mask, region, data);
|
||||
}
|
||||
|
||||
void BlurEffect::paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity)
|
||||
{
|
||||
const QRect screen(0, 0, displayWidth(), displayHeight());
|
||||
bool valid = target->valid() && shader->isValid();
|
||||
QRegion shape = frame->geometry().adjusted( -5, -5, 5, 5 ) & screen;
|
||||
if (valid && !shape.isEmpty() && region.intersects(shape.boundingRect())) {
|
||||
doBlur(shape, screen, opacity * frameOpacity);
|
||||
}
|
||||
effects->paintEffectFrame(frame, region, opacity, frameOpacity);
|
||||
}
|
||||
|
||||
void BlurEffect::doBlur(const QRegion& shape, const QRect& screen, const float opacity)
|
||||
{
|
||||
const QRegion expanded = expand(shape) & screen;
|
||||
const QRect r = expanded.boundingRect();
|
||||
|
@ -272,7 +296,6 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai
|
|||
shader->setPixelDistance(1.0 / tex->height());
|
||||
|
||||
// Modulate the blurred texture with the window opacity if the window isn't opaque
|
||||
const float opacity = data.opacity * data.contents_opacity;
|
||||
if (opacity < 1.0) {
|
||||
glPushAttrib(GL_COLOR_BUFFER_BIT);
|
||||
glEnable(GL_BLEND);
|
||||
|
@ -296,14 +319,6 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai
|
|||
|
||||
tex->unbind();
|
||||
shader->unbind();
|
||||
|
||||
// Rebind the shader used for drawing the window if one was set
|
||||
if (data.shader)
|
||||
data.shader->bind();
|
||||
}
|
||||
|
||||
// Draw the window over the blurred area
|
||||
effects->drawWindow(w, mask, region, data);
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
void propertyNotify(EffectWindow *w, long atom);
|
||||
void paintScreen(int mask, QRegion region, ScreenPaintData &data);
|
||||
void drawWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data);
|
||||
void paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity);
|
||||
|
||||
private:
|
||||
QRect expand(const QRect &rect) const;
|
||||
|
@ -51,6 +52,7 @@ private:
|
|||
QRegion blurRegion(const EffectWindow *w) const;
|
||||
void updateBlurRegion(EffectWindow *w) const;
|
||||
void drawRegion(const QRegion ®ion);
|
||||
void doBlur(const QRegion &shape, const QRect &screen, const float opacity);
|
||||
|
||||
private:
|
||||
BlurShader *shader;
|
||||
|
|
Loading…
Reference in a new issue