Commit c7262e8b authored by Martin Flöser's avatar Martin Flöser

Getter/setters for opacity, saturation and brightness in WindowPaintData

The public member variables for opacity, saturation and brightness
are removed in favor for getter and setters. The variables are
moved into a private class. Those are now qreal instead of double.

To make usage inside the effects easier a multiply method is added
which multiplies the current value with passed in factor and returns
the new value in a functional programming style.

This commit is the top-most of a patch series to refactor
ScreenPaintData and WindowPaintData. Other related commits are:
* 0811772
* ebdc7ec
* 2c8dd8d
* 7699726
* 68e0201
* 611cb09

REVIEW: 105141
BUG: 303314
FIXED-IN: 4.10
parent f723f132
......@@ -394,9 +394,9 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai
if (!shape.isEmpty()) {
if (m_shouldCache && !translated) {
doCachedBlur(w, region, data.opacity);
doCachedBlur(w, region, data.opacity());
} else {
doBlur(shape, screen, data.opacity);
doBlur(shape, screen, data.opacity());
}
}
}
......
......@@ -213,9 +213,9 @@ void BoxSwitchEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
if (windows.contains(w) && w != selected_window) {
if (w->isMinimized() || !w->isOnCurrentDesktop())
// TODO: When deactivating minimized windows are not painted at all
data.opacity *= activeTimeLine.currentValue() * bg_opacity;
data.multiplyOpacity(activeTimeLine.currentValue() * bg_opacity);
else
data.opacity *= 1.0 - activeTimeLine.currentValue() * (1.0 - bg_opacity);
data.multiplyOpacity(1.0 - activeTimeLine.currentValue() * (1.0 - bg_opacity));
}
}
effects->paintWindow(w, mask, region, data);
......
......@@ -508,18 +508,18 @@ void CoverSwitchEffect::paintWindow(EffectWindow* w, int mask, QRegion region, W
if (mActivated || stop || stopRequested) {
if (!(mask & PAINT_WINDOW_TRANSFORMED) && !w->isDesktop()) {
if ((start || stop) && w->isDock()) {
data.opacity = 1.0 - timeLine.currentValue();
data.setOpacity(1.0 - timeLine.currentValue());
if (stop)
data.opacity = timeLine.currentValue();
data.setOpacity(timeLine.currentValue());
} else
return;
}
}
if ((start || stop) && (!w->isOnCurrentDesktop() || w->isMinimized())) {
if (stop) // Fade out windows not on the current desktop
data.opacity = (1.0 - timeLine.currentValue());
data.setOpacity((1.0 - timeLine.currentValue()));
else // Fade in Windows from other desktops when animation is started
data.opacity = timeLine.currentValue();
data.setOpacity(timeLine.currentValue());
}
effects->paintWindow(w, mask, region, data);
}
......@@ -675,7 +675,7 @@ void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow,
data.setZTranslation(-zPosition);
if (start) {
if (w->isMinimized()) {
data.opacity *= timeLine.currentValue();
data.multiplyOpacity(timeLine.currentValue());
} else {
const QVector3D translation = data.translation() * timeLine.currentValue();
data.setXTranslation(translation.x());
......@@ -705,7 +705,7 @@ void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow,
}
if (stop) {
if (w->isMinimized() && w != effects->activeWindow()) {
data.opacity *= (1.0 - timeLine.currentValue());
data.multiplyOpacity((1.0 - timeLine.currentValue()));
} else {
const QVector3D translation = data.translation() * (1.0 - timeLine.currentValue());
data.setXTranslation(translation.x());
......@@ -744,9 +744,9 @@ void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow,
shader->setUniform("screenTransformation", origMatrix * reflectionMatrix);
data.setYTranslation(- area.height() - windowRect.y() - windowRect.height());
if (start) {
data.opacity *= timeLine.currentValue();
data.multiplyOpacity(timeLine.currentValue());
} else if (stop) {
data.opacity *= 1.0 - timeLine.currentValue();
data.multiplyOpacity(1.0 - timeLine.currentValue());
}
effects->drawWindow(w,
PAINT_WINDOW_TRANSFORMED,
......@@ -809,7 +809,7 @@ void CoverSwitchEffect::paintFrontWindow(EffectWindow* frontWindow, int width, i
}
}
if (specialHandlingForward) {
data.opacity *= (1.0 - timeLine.currentValue() * 2.0);
data.multiplyOpacity((1.0 - timeLine.currentValue() * 2.0));
paintWindowCover(frontWindow, reflectedWindow, data);
} else
paintWindowCover(frontWindow, reflectedWindow, data);
......@@ -843,7 +843,7 @@ void CoverSwitchEffect::paintWindows(const EffectWindowList& windows, bool left,
additionalWindow->geometry().x() - additionalWindow->geometry().width());
data.setRotationOrigin(QVector3D(additionalWindow->geometry().width(), 0.0, 0.0));
}
data.opacity *= (timeLine.currentValue() - 0.5) * 2.0;
data.multiplyOpacity((timeLine.currentValue() - 0.5) * 2.0);
paintWindowCover(additionalWindow, reflectedWindows, data);
}
// normal behaviour
......@@ -894,7 +894,7 @@ void CoverSwitchEffect::paintWindows(const EffectWindowList& windows, bool left,
if (animation && i == 0 && ((direction == Left && left) || (direction == Right && !left))) {
// only for the first half of the animation
if (timeLine.currentValue() < 0.5) {
data.opacity *= (1.0 - timeLine.currentValue() * 2.0);
data.multiplyOpacity((1.0 - timeLine.currentValue() * 2.0));
paintWindowCover(window, reflectedWindows, data);
}
} else {
......
......@@ -1438,7 +1438,7 @@ void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa
opacity = 0.99f;
if (opacityDesktopOnly && !w->isDesktop())
opacity = 0.99f;
data.opacity *= opacity;
data.multiplyOpacity(opacity);
if (w->isOnDesktop(painting_desktop) && w->x() < rect.x()) {
WindowQuadList new_quads;
......
......@@ -343,9 +343,9 @@ void CubeSlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
data.quads = new_quads;
}
if (firstDesktop)
data.opacity *= timeLine.currentValue();
data.multiplyOpacity(timeLine.currentValue());
else
data.opacity *= (1.0 - timeLine.currentValue());
data.multiplyOpacity((1.0 - timeLine.currentValue()));
}
}
effects->paintWindow(w, mask, region, data);
......
......@@ -82,16 +82,14 @@ void DashboardEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
{
if (transformWindow && (w != window) && w->isManaged() && !isDashboard(w)) {
// dashboard active, transform other windows
data.brightness *= (1 - ((1.0 - brightness) * timeline.currentValue()));
data.saturation *= (1 - ((1.0 - saturation) * timeline.currentValue()));
data.multiplyBrightness((1 - ((1.0 - brightness) * timeline.currentValue())));
data.multiplySaturation((1 - ((1.0 - saturation) * timeline.currentValue())));
}
else if (transformWindow && (w == window) && w->isManaged()) {
// transform dashboard
if ((timeline.currentValue() * 2) <= 1) {
data.opacity *= timeline.currentValue() * 2;
} else {
data.opacity *= 1;
data.multiplyOpacity(timeline.currentValue() * 2);
}
}
......
......@@ -180,7 +180,7 @@ void DesktopGridEffect::paintScreen(int mask, QRegion region, ScreenPaintData& d
}
if (it.value()) {
WindowPaintData d(it.value());
d.opacity *= timeline.currentValue();
d.multiplyOpacity(timeline.currentValue());
effects->drawWindow(it.value(), PAINT_WINDOW_TRANSLUCENT,
infiniteRegion(), d);
}
......@@ -291,7 +291,7 @@ void DesktopGridEffect::paintWindow(EffectWindow* w, int mask, QRegion region, W
// Don't change brightness of windows on all desktops as this causes flickering
if (!w->isOnAllDesktops() || w->isDesktop())
data.brightness *= 1.0 - (0.3 * (1.0 - hoverTimeline[paintingDesktop - 1]->currentValue()));
data.multiplyBrightness(1.0 - (0.3 * (1.0 - hoverTimeline[paintingDesktop - 1]->currentValue())));
for (int screen = 0; screen < effects->numScreens(); screen++) {
// Assume desktop windows can never be on two screens at once (Plasma makes one window per screen)
......@@ -338,10 +338,10 @@ void DesktopGridEffect::paintWindow(EffectWindow* w, int mask, QRegion region, W
if (isUsingPresentWindows() && (w->isDock() || w->isSkipSwitcher())) {
// fade out panels if present windows is used
d.opacity *= (1.0 - timeline.currentValue());
d.multiplyOpacity((1.0 - timeline.currentValue()));
}
if (isUsingPresentWindows() && w->isMinimized()) {
d.opacity *= timeline.currentValue();
d.multiplyOpacity(timeline.currentValue());
}
if (effects->compositingType() == XRenderCompositing) {
......
......@@ -58,8 +58,8 @@ void DialogParentEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
{
const float s = effectStrength.value(w, 0.0);
if (s > 0.0f) {
data.brightness *= (1.0f - 0.4*s); // [1.0; 0.6]
data.saturation *= (1.0f - 0.6*s); // [1.0; 0.4]
data.multiplyBrightness((1.0f - 0.4*s)); // [1.0; 0.6]
data.multiplySaturation((1.0f - 0.6*s)); // [1.0; 0.4]
}
effects->paintWindow(w, mask, region, data);
}
......
......@@ -74,8 +74,8 @@ void DimInactiveEffect::paintWindow(EffectWindow* w, int mask, QRegion region, W
previous = previousActiveTimeline.currentValue();
if (previousActiveTimeline.currentValue() == 1.0)
previousActive = NULL;
data.brightness *= (1.0 - (dim_strength / 100.0) * timeline.currentValue() * previous);
data.saturation *= (1.0 - (dim_strength / 100.0) * timeline.currentValue() * previous);
data.multiplyBrightness((1.0 - (dim_strength / 100.0) * timeline.currentValue() * previous));
data.multiplySaturation((1.0 - (dim_strength / 100.0) * timeline.currentValue() * previous));
}
effects->paintWindow(w, mask, region, data);
}
......
......@@ -79,8 +79,8 @@ void DimScreenEffect::postPaintScreen()
void DimScreenEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
{
if (mActivated && (w != window) && w->isManaged()) {
data.brightness *= (1.0 - 0.33 * timeline.currentValue());
data.saturation *= (1.0 - 0.33 * timeline.currentValue());
data.multiplyBrightness((1.0 - 0.33 * timeline.currentValue()));
data.multiplySaturation((1.0 - 0.33 * timeline.currentValue()));
}
effects->paintWindow(w, mask, region, data);
}
......
......@@ -147,7 +147,7 @@ void ExplosionEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
data.setXScale(scale);
data.setYScale(scale);
data.translate(int(w->width() / 2 * (1 - scale)), int(w->height() / 2 * (1 - scale)));
data.opacity *= 0.99; // Force blending
data.multiplyOpacity(0.99); // Force blending
ShaderManager *manager = ShaderManager::instance();
GLShader *shader = manager->pushShader(ShaderManager::GenericShader);
QMatrix4x4 screenTransformation = shader->getUniformMatrix4x4("screenTransformation");
......
......@@ -296,9 +296,9 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
WindowPaintData data(w);
data.setRotationAxis(Qt::YAxis);
data.setRotationAngle(m_angle * m_startStopTimeLine.currentValue());
data.opacity = info->opacity;
data.brightness = info->brightness;
data.saturation = info->saturation;
data.setOpacity(info->opacity);
data.setBrightness(info->brightness);
data.setSaturation(info->saturation);
int distance = tempList.count() - 1;
float zDistance = 500.0f;
data.translate(- (w->x() - m_screenArea.x() + data.xTranslation()) * m_startStopTimeLine.currentValue());
......@@ -309,9 +309,9 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
- (m_screenArea.height() * 0.10f) * distance * m_startStopTimeLine.currentValue(),
- (zDistance * distance) * m_startStopTimeLine.currentValue());
if (m_scheduledDirections.head() == DirectionForward)
data.opacity *= 0.8 * m_timeLine.currentValue();
data.multiplyOpacity(0.8 * m_timeLine.currentValue());
else
data.opacity *= 0.8 * (1.0 - m_timeLine.currentValue());
data.multiplyOpacity(0.8 * (1.0 - m_timeLine.currentValue()));
if (effects->numScreens() > 1) {
adjustWindowMultiScreen(w, data);
......@@ -327,9 +327,9 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
WindowPaintData data(w);
data.setRotationAxis(Qt::YAxis);
data.setRotationAngle(m_angle * m_startStopTimeLine.currentValue());
data.opacity = info->opacity;
data.brightness = info->brightness;
data.saturation = info->saturation;
data.setOpacity(info->opacity);
data.setBrightness(info->brightness);
data.setSaturation(info->saturation);
int windowIndex = tempList.indexOf(w);
int distance;
if (m_mode == TabboxMode) {
......@@ -349,7 +349,7 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
if (!m_scheduledDirections.isEmpty() && m_scheduledDirections.head() == DirectionBackward) {
if (w == m_flipOrderedWindows.last()) {
distance = -1;
data.opacity *= m_timeLine.currentValue();
data.multiplyOpacity(m_timeLine.currentValue());
}
}
float zDistance = 500.0f;
......@@ -366,14 +366,14 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
(m_screenArea.height() * 0.10f) * m_timeLine.currentValue(),
zDistance * m_timeLine.currentValue());
if (distance == 0)
data.opacity *= (1.0 - m_timeLine.currentValue());
data.multiplyOpacity((1.0 - m_timeLine.currentValue()));
} else {
data.translate(- (m_screenArea.width() * 0.25f) * m_timeLine.currentValue(),
- (m_screenArea.height() * 0.10f) * m_timeLine.currentValue(),
- zDistance * m_timeLine.currentValue());
}
}
data.opacity *= (0.8 + 0.2 * (1.0 - m_startStopTimeLine.currentValue()));
data.multiplyOpacity((0.8 + 0.2 * (1.0 - m_startStopTimeLine.currentValue())));
if (effects->numScreens() > 1) {
adjustWindowMultiScreen(w, data);
}
......@@ -486,15 +486,15 @@ void FlipSwitchEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Wi
if (m_active) {
ItemInfo *info = m_windows.value(w,0);
if (info) {
info->opacity = data.opacity;
info->brightness = data.brightness;
info->saturation = data.saturation;
info->opacity = data.opacity();
info->brightness = data.brightness();
info->saturation = data.saturation();
}
// fade out all windows not in window list except the desktops
const bool isFader = (m_start || m_stop) && !info && !w->isDesktop();
if (isFader)
data.opacity *= (1.0 - m_startStopTimeLine.currentValue());
data.multiplyOpacity((1.0 - m_startStopTimeLine.currentValue()));
// if not a fader or the desktop, skip painting here to prevent flicker
if (!(isFader || w->isDesktop()))
......
......@@ -100,7 +100,7 @@ void GlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowP
const double progress = info->timeLine->currentValue();
data.setRotationAxis(Qt::XAxis);
data.setRotationAngle(angle * (1 - progress));
data.opacity *= progress;
data.multiplyOpacity(progress);
switch(effect) {
default:
case GlideInOut:
......
......@@ -108,7 +108,7 @@ void HighlightWindowEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData&
void HighlightWindowEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
data.opacity *= m_windowOpacity.value(w, 1.0f);
data.multiplyOpacity(m_windowOpacity.value(w, 1.0f));
effects->paintWindow(w, mask, region, data);
}
......
......@@ -67,13 +67,13 @@ void LoginEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowP
if (w == login_window) {
if (m_fadeToBlack) {
if (progress < 0.5)
data.brightness *= (1.0 - progress * 2);
data.multiplyBrightness((1.0 - progress * 2));
if (progress >= 0.5) {
data.opacity *= (1.0 - (progress - 0.5) * 2);
data.brightness = 0;
data.multiplyOpacity((1.0 - (progress - 0.5) * 2));
data.setBrightness(0);
}
} else if (progress < 1.0) {
data.opacity *= (1.0 - progress);
data.multiplyOpacity((1.0 - progress));
}
}
......
......@@ -150,16 +150,16 @@ void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
// until after we render the FBO to the screen.
if (w == logoutWindow) {
// Window is rendered after the FBO
windowOpacity = data.opacity;
data.opacity = 0.0; // Cheat, we need the opacity for later but don't want to blur it
windowOpacity = data.opacity();
data.setOpacity(0.0); // Cheat, we need the opacity for later but don't want to blur it
} else {
if (logoutWindowPassed || ignoredWindows.contains(w)) {
// Window is rendered after the FBO
windows.append(w);
windowsOpacities[ w ] = data.opacity;
data.opacity = 0.0;
windowsOpacities[ w ] = data.opacity();
data.setOpacity(0.0);
} else // Window is added to the FBO
data.saturation *= (1.0 - progress * 0.2);
data.multiplySaturation((1.0 - progress * 0.2));
}
} else {
// If we are not blurring then we are not rendering to an FBO
......@@ -168,15 +168,15 @@ void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
renderVignetting();
else if (!logoutWindowPassed && !ignoredWindows.contains(w))
// Window is in the background, desaturate
data.saturation *= (1.0 - progress * 0.2);
data.multiplySaturation((1.0 - progress * 0.2));
// All other windows are unaltered
}
}
if (effects->compositingType() == KWin::XRenderCompositing) {
// Since we can't do vignetting in XRender just do a stronger desaturation and darken
if (w != logoutWindow && !logoutWindowPassed && !ignoredWindows.contains(w)) {
data.saturation *= (1.0 - progress * 0.8);
data.brightness *= (1.0 - progress * 0.3);
data.multiplySaturation((1.0 - progress * 0.8));
data.multiplyBrightness((1.0 - progress * 0.3));
}
}
if (w == logoutWindow ||
......@@ -216,7 +216,7 @@ void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
if (logoutWindow) {
int winMask = logoutWindow->hasAlpha() ? PAINT_WINDOW_TRANSLUCENT : PAINT_WINDOW_OPAQUE;
WindowPaintData winData(logoutWindow);
winData.opacity = windowOpacity;
winData.setOpacity(windowOpacity);
effects->drawWindow(logoutWindow, winMask, region, winData);
}
......@@ -224,7 +224,7 @@ void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
foreach (EffectWindow * w, windows) {
int winMask = w->hasAlpha() ? PAINT_WINDOW_TRANSLUCENT : PAINT_WINDOW_OPAQUE;
WindowPaintData winData(w);
winData.opacity = windowsOpacities[ w ];
winData.setOpacity(windowsOpacities[ w ]);
effects->drawWindow(w, winMask, region, winData);
}
......
......@@ -96,7 +96,7 @@ void MinimizeAnimationEffect::paintWindow(EffectWindow* w, int mask, QRegion reg
interpolate(1.0, icon.height() / (double)geo.height(), progress));
data.setXTranslation((int)interpolate(data.xTranslation(), icon.x() - geo.x(), progress));
data.setYTranslation((int)interpolate(data.yTranslation(), icon.y() - geo.y(), progress));
data.opacity *= 0.1 + (1 - progress) * 0.9;
data.multiplyOpacity(0.1 + (1 - progress) * 0.9);
}
// Call the next effect.
......
......@@ -337,8 +337,8 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region
mask |= PAINT_WINDOW_LANCZOS;
// Apply opacity and brightness
data.opacity *= winData->opacity;
data.brightness *= interpolate(0.40, 1.0, winData->highlight);
data.multiplyOpacity(winData->opacity);
data.multiplyBrightness(interpolate(0.40, 1.0, winData->highlight));
if (m_motionManager.isManaging(w)) {
if (w->isDesktop()) {
......@@ -397,20 +397,20 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region
rect.y() + rect.height() * 0.95);
winData->iconFrame->setPosition(point);
if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) {
const float a = 0.9 * data.opacity * m_decalOpacity * 0.75;
const float a = 0.9 * data.opacity() * m_decalOpacity * 0.75;
data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a));
}
winData->iconFrame->render(region, 0.9 * data.opacity * m_decalOpacity, 0.75);
winData->iconFrame->render(region, 0.9 * data.opacity() * m_decalOpacity, 0.75);
}
if (m_showCaptions) {
QPoint point(rect.x() + rect.width() / 2,
rect.y() + rect.height() / 2);
winData->textFrame->setPosition(point);
if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) {
const float a = 0.9 * data.opacity * m_decalOpacity * 0.75;
const float a = 0.9 * data.opacity() * m_decalOpacity * 0.75;
data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a));
}
winData->textFrame->render(region, 0.9 * data.opacity * m_decalOpacity, 0.75);
winData->textFrame->render(region, 0.9 * data.opacity() * m_decalOpacity, 0.75);
}
} else
effects->paintWindow(w, mask, region, data);
......
......@@ -58,7 +58,7 @@ void ScaleInEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Windo
{
if (mTimeLineWindows.contains(w) && isScaleWindow(w)) {
const qreal value = mTimeLineWindows[ w ]->currentValue();
data.opacity *= value;
data.multiplyOpacity(value);
data *= QVector2D(value, value);
data += QPoint(int(w->width() / 2 * (1 - value)), int(w->height() / 2 * (1 - value)));
}
......
......@@ -70,7 +70,7 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi
if (thumbnails.contains(w)) {
// paint thumbnails on it
int mask = PAINT_WINDOW_TRANSFORMED;
if (data.opacity == 1.0)
if (data.opacity() == 1.0)
mask |= PAINT_WINDOW_OPAQUE;
else
mask |= PAINT_WINDOW_TRANSLUCENT;
......@@ -80,7 +80,7 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi
if (thumbw == NULL)
continue;
WindowPaintData thumbData(thumbw);
thumbData.opacity *= data.opacity;
thumbData.multiplyOpacity(data.opacity());
QRect r, thumbRect(thumb.rect);
thumbRect.translate(w->pos() + QPoint(data.xTranslation(), data.yTranslation()));
thumbRect.setSize(QSize(thumbRect.width() * data.xScale(), thumbRect.height() * data.yScale())); // QSize has no vector multiplicator... :-(
......
......@@ -60,7 +60,7 @@ void ThumbnailAsideEffect::paintScreen(int mask, QRegion region, ScreenPaintData
foreach (const Data & d, windows) {
if (region.contains(d.rect)) {
WindowPaintData data(d.window);
data.opacity = opacity;
data.multiplyOpacity(opacity);
QRect region;
setPositionTransformations(data, region, d.window, d.rect, Qt::KeepAspectRatio);
effects->drawWindow(d.window, PAINT_WINDOW_OPAQUE | PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_LANCZOS,
......
......@@ -110,10 +110,10 @@ void TranslucencyEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
}
// Handling active and inactive windows
if (inactive != 1.0 && isInactive(w)) {
data.opacity *= inactive;
data.multiplyOpacity(inactive);
if (w == previous) {
data.opacity *= (inactive + ((1.0 - inactive) * (1.0 - activeinactive_timeline.currentValue())));
data.multiplyOpacity((inactive + ((1.0 - inactive) * (1.0 - activeinactive_timeline.currentValue()))));
if (activeinactive_timeline.currentValue() < 1.0)
w->addRepaintFull();
else
......@@ -122,22 +122,22 @@ void TranslucencyEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
} else {
// Fading in
if (!isInactive(w) && !w->isDesktop()) {
data.opacity *= (inactive + ((1.0 - inactive) * activeinactive_timeline.currentValue()));
data.multiplyOpacity((inactive + ((1.0 - inactive) * activeinactive_timeline.currentValue())));
if (activeinactive_timeline.currentValue() < 1.0)
w->addRepaintFull();
}
// decoration and dialogs
if (decoration != 1.0 && w->hasDecoration())
data.decoration_opacity *= decoration;
data.multiplyDecorationOpacity(decoration);
if (dialogs != 1.0 && w->isDialog())
data.opacity *= dialogs;
data.multiplyOpacity(dialogs);
// Handling moving and resizing
if (moveresize != 1.0 && !w->isDesktop() && !w->isDock()) {
double progress = moveresize_timeline.currentValue();
if (w->isUserMove() || w->isUserResize()) {
// Fading to translucent
data.opacity *= (moveresize + ((1.0 - moveresize) * (1.0 - progress)));
data.multiplyOpacity((moveresize + ((1.0 - moveresize) * (1.0 - progress))));
if (progress < 1.0 && progress > 0.0) {
w->addRepaintFull();
fadeout = w;
......@@ -145,7 +145,7 @@ void TranslucencyEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
} else {
// Fading back to more opaque
if (w == fadeout && !w->isUserMove() && !w->isUserResize()) {
data.opacity *= (moveresize + ((1.0 - moveresize) * (progress)));
data.multiplyOpacity((moveresize + ((1.0 - moveresize) * (progress))));
if (progress == 1.0 || progress == 0.0)
fadeout = NULL;
else
......@@ -157,13 +157,13 @@ void TranslucencyEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
// Menus and combos
if (dropdownmenus != 1.0 && w->isDropdownMenu())
data.opacity *= dropdownmenus;
data.multiplyOpacity(dropdownmenus);
if (popupmenus != 1.0 && w->isPopupMenu())
data.opacity *= popupmenus;
data.multiplyOpacity(popupmenus);
if (tornoffmenus != 1.0 && w->isMenu())
data.opacity *= tornoffmenus;
data.multiplyOpacity(tornoffmenus);
if (comboboxpopups != 1.0 && w->isComboBox())
data.opacity *= comboboxpopups;