Blur behind sliding popups

Finally it is possible :-) If it causes an impact on performance
during the release candidates I'm going to revert.
REVIEW: 103375
BUG: 255106
FIXED-IN: 4.8.0
This commit is contained in:
Martin Gräßlin 2011-12-10 22:32:47 +01:00
parent de8b9f546f
commit 544c4d60b5
2 changed files with 24 additions and 4 deletions

View file

@ -347,7 +347,7 @@ bool BlurEffect::shouldBlur(const EffectWindow *w, int mask, const WindowPaintDa
bool scaled = !qFuzzyCompare(data.xScale, 1.0) && !qFuzzyCompare(data.yScale, 1.0);
bool translated = data.xTranslate || data.yTranslate;
if (scaled || translated || (mask & PAINT_WINDOW_TRANSFORMED))
if (scaled || ((translated || (mask & PAINT_WINDOW_TRANSFORMED)) && !w->data(WindowForceBlurRole).toBool()))
return false;
bool blurBehindDecos = effects->decorationsHaveAlpha() &&
@ -363,10 +363,17 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai
{
const QRect screen(0, 0, displayWidth(), displayHeight());
if (shouldBlur(w, mask, data)) {
const QRegion shape = region & blurRegion(w).translated(w->pos()) & screen;
QRegion shape = region & blurRegion(w).translated(w->pos()) & screen;
const bool translated = data.xTranslate || data.yTranslate;
// let's do the evil parts - someone wants to blur behind a transformed window
if (translated) {
shape = shape.translated(data.xTranslate, data.yTranslate);
shape = shape & region;
}
if (!shape.isEmpty()) {
if (m_shouldCache) {
if (m_shouldCache && !translated) {
doCachedBlur(w, region, data.opacity * data.contents_opacity);
} else {
doBlur(shape, screen, data.opacity * data.contents_opacity);

View file

@ -90,8 +90,10 @@ void SlidingPopupsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da
data.setTransformed();
progress = mAppearingWindows[ w ]->currentValue();
appearing = true;
} else
} else {
delete mAppearingWindows.take(w);
w->setData(WindowForceBlurRole, false);
}
} else if (mDisappearingWindows.contains(w)) {
mDisappearingWindows[ w ]->setCurrentTime(mDisappearingWindows[ w ]->currentTime() + time);
@ -192,19 +194,28 @@ void SlidingPopupsEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
const int start = mWindowsData[ w ].start;
const QRect screenRect = effects->clientArea(FullScreenArea, w->screen(), w->desktop());
int splitPoint = 0;
switch(mWindowsData[ w ].from) {
case West:
data.xTranslate -= w->width() * progress;
splitPoint = w->width() - (w->x() + w->width() - screenRect.x() - start);
region = QRegion(w->x() + splitPoint, w->y(), w->width() - splitPoint, w->height());
break;
case North:
data.yTranslate -= w->height() * progress;
splitPoint = w->height() - (w->y() + w->height() - screenRect.y() - start);
region = QRegion(w->x(), w->y() + splitPoint, w->width(), w->height() - splitPoint);
break;
case East:
data.xTranslate += w->width() * progress;
splitPoint = screenRect.x() + screenRect.width() - w->x() - start;
region = QRegion(w->x(), w->y(), splitPoint, w->height());
break;
case South:
default:
data.yTranslate += w->height() * progress;
splitPoint = screenRect.y() + screenRect.height() - w->y() - start;
region = QRegion(w->x(), w->y(), w->width(), splitPoint);
}
}
@ -228,6 +239,7 @@ void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w)
// Tell other windowAdded() effects to ignore this window
w->setData(WindowAddedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
w->setData(WindowForceBlurRole, true);
w->addRepaintFull();
}
@ -244,6 +256,7 @@ void SlidingPopupsEffect::slotWindowClosed(EffectWindow* w)
// Tell other windowClosed() effects to ignore this window
w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
w->setData(WindowForceBlurRole, true);
w->addRepaintFull();
}