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

Replace translation by QVector3D in Screen/Window PaintData

parent 0eff12eb
......@@ -365,7 +365,7 @@ bool BlurEffect::shouldBlur(const EffectWindow *w, int mask, const WindowPaintDa
return false;
bool scaled = !qFuzzyCompare(data.xScale(), 1.0) && !qFuzzyCompare(data.yScale(), 1.0);
bool translated = data.xTranslate || data.yTranslate;
bool translated = data.xTranslation() || data.yTranslation();
if (scaled || ((translated || (mask & PAINT_WINDOW_TRANSFORMED)) && !w->data(WindowForceBlurRole).toBool()))
return false;
......@@ -385,10 +385,10 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai
if (shouldBlur(w, mask, data)) {
QRegion shape = region & blurRegion(w).translated(w->pos()) & screen;
const bool translated = data.xTranslate || data.yTranslate;
const bool translated = data.xTranslation() || data.yTranslation();
// 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.translated(data.xTranslation(), data.yTranslation());
shape = shape & region;
}
......
......@@ -850,8 +850,8 @@ void BoxSwitchEffect::paintDesktopThumbnail(int iDesktop)
int x = r.x() + (r.width() - width) / 2;
int y = r.y() + (r.height() - height) / 2;
region = QRect(x, y, width, height);
data.xTranslate = x;
data.yTranslate = y;
data.setXTranslation(x);
data.setYTranslation(y);
effects->paintScreen(PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_BACKGROUND_FIRST,
region, data);
......
......@@ -671,34 +671,35 @@ void CoverSwitchEffect::slotTabBoxUpdated()
void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow, WindowPaintData& data)
{
QRect windowRect = w->geometry();
data.yTranslate = area.height() - windowRect.y() - windowRect.height();
data.zTranslate = -zPosition;
data.setYTranslation(area.height() - windowRect.y() - windowRect.height());
data.setZTranslation(-zPosition);
if (start) {
if (w->isMinimized()) {
data.opacity *= timeLine.currentValue();
} else {
data.xTranslate *= timeLine.currentValue();
data.yTranslate *= timeLine.currentValue();
const QVector3D translation = data.translation() * timeLine.currentValue();
data.setXTranslation(translation.x());
data.setYTranslation(translation.y());
data.setZTranslation(translation.z());
if (effects->numScreens() > 1) {
QRect clientRect = effects->clientArea(FullScreenArea, w->screen(), effects->currentDesktop());
QRect fullRect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop());
if (w->screen() == activeScreen) {
if (clientRect.width() != fullRect.width() && clientRect.x() != fullRect.x()) {
data.xTranslate -= clientRect.x() * (1.0f - timeLine.currentValue());
data.translate(- clientRect.x() * (1.0f - timeLine.currentValue()));
}
if (clientRect.height() != fullRect.height() && clientRect.y() != fullRect.y()) {
data.yTranslate -= clientRect.y() * (1.0f - timeLine.currentValue());
data.translate(0.0, - clientRect.y() * (1.0f - timeLine.currentValue()));
}
} else {
if (clientRect.width() != fullRect.width() && clientRect.x() < area.x()) {
data.xTranslate -= clientRect.width() * (1.0f - timeLine.currentValue());
data.translate(- clientRect.width() * (1.0f - timeLine.currentValue()));
}
if (clientRect.height() != fullRect.height() && clientRect.y() < area.y()) {
data.yTranslate -= clientRect.height() * (1.0f - timeLine.currentValue());
data.translate(0.0, - clientRect.height() * (1.0f - timeLine.currentValue()));
}
}
}
data.zTranslate *= timeLine.currentValue();
data.rotation.setAngle(data.rotation.angle() * timeLine.currentValue());
}
}
......@@ -706,29 +707,30 @@ void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow,
if (w->isMinimized() && w != effects->activeWindow()) {
data.opacity *= (1.0 - timeLine.currentValue());
} else {
data.xTranslate *= (1.0 - timeLine.currentValue());
data.yTranslate *= (1.0 - timeLine.currentValue());
const QVector3D translation = data.translation() * (1.0 - timeLine.currentValue());
data.setXTranslation(translation.x());
data.setYTranslation(translation.y());
data.setZTranslation(translation.z());
if (effects->numScreens() > 1) {
QRect clientRect = effects->clientArea(FullScreenArea, w->screen(), effects->currentDesktop());
QRect rect = effects->clientArea(FullScreenArea, activeScreen, effects->currentDesktop());
QRect fullRect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop());
if (w->screen() == activeScreen) {
if (clientRect.width() != fullRect.width() && clientRect.x() != fullRect.x()) {
data.xTranslate -= clientRect.x() * timeLine.currentValue();
data.translate(- clientRect.x() * timeLine.currentValue());
}
if (clientRect.height() != fullRect.height() && clientRect.y() != fullRect.y()) {
data.yTranslate -= clientRect.y() * timeLine.currentValue();
data.translate(0.0, - clientRect.y() * timeLine.currentValue());
}
} else {
if (clientRect.width() != fullRect.width() && clientRect.x() < rect.x()) {
data.xTranslate -= clientRect.width() * timeLine.currentValue();
data.translate(- clientRect.width() * timeLine.currentValue());
}
if (clientRect.height() != fullRect.height() && clientRect.y() < area.y()) {
data.yTranslate -= clientRect.height() * timeLine.currentValue();
data.translate(0.0, - clientRect.height() * timeLine.currentValue());
}
}
}
data.zTranslate *= (1.0 - timeLine.currentValue());
data.rotation.setAngle(data.rotation.angle() * (1.0 - timeLine.currentValue()));
}
}
......@@ -740,7 +742,7 @@ void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow,
QMatrix4x4 reflectionMatrix;
reflectionMatrix.scale(1.0, -1.0, 1.0);
shader->setUniform("screenTransformation", origMatrix * reflectionMatrix);
data.yTranslate = - area.height() - windowRect.y() - windowRect.height();
data.setYTranslation(- area.height() - windowRect.y() - windowRect.height());
if (start) {
data.opacity *= timeLine.currentValue();
} else if (stop) {
......@@ -755,7 +757,7 @@ void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow,
#ifndef KWIN_HAVE_OPENGLES
glPushMatrix();
glScalef(1.0, -1.0, 1.0);
data.yTranslate = - area.height() - windowRect.y() - windowRect.height();
data.setYTranslation(- area.height() - windowRect.y() - windowRect.height());
effects->paintWindow(w,
PAINT_WINDOW_TRANSFORMED,
infiniteRegion(), data);
......@@ -775,7 +777,7 @@ void CoverSwitchEffect::paintFrontWindow(EffectWindow* frontWindow, int width, i
return;
bool specialHandlingForward = false;
WindowPaintData data(frontWindow);
data.xTranslate = area.width() * 0.5 - frontWindow->geometry().x() - frontWindow->geometry().width() * 0.5;
data.setXTranslation(area.width() * 0.5 - frontWindow->geometry().x() - frontWindow->geometry().width() * 0.5);
if (leftWindows == 0) {
leftWindows = 1;
if (!start && !stop)
......@@ -790,7 +792,7 @@ void CoverSwitchEffect::paintFrontWindow(EffectWindow* frontWindow, int width, i
// move to right
distance = -frontWindow->geometry().width() * 0.5f + area.width() * 0.5f +
(((float)displayWidth() * 0.5 * scaleFactor) - (float)area.width() * 0.5f) / rightWindows;
data.xTranslate += distance * timeLine.currentValue();
data.translate(distance * timeLine.currentValue());
data.rotation.setAxis(Qt::YAxis);
data.rotation.setAngle(-angle * timeLine.currentValue());
data.rotation.setOrigin(QVector3D(frontWindow->geometry().width(), 0.0, 0.0));
......@@ -801,7 +803,7 @@ void CoverSwitchEffect::paintFrontWindow(EffectWindow* frontWindow, int width, i
float factor = 1.0;
if (specialHandlingForward)
factor = 2.0;
data.xTranslate += distance * timeLine.currentValue() * factor;
data.translate(distance * timeLine.currentValue() * factor);
data.rotation.setAxis(Qt::YAxis);
data.rotation.setAngle(angle * timeLine.currentValue());
}
......@@ -834,11 +836,11 @@ void CoverSwitchEffect::paintWindows(const EffectWindowList& windows, bool left,
data.rotation.setAxis(Qt::YAxis);
data.rotation.setAngle(angle * rotateFactor);
if (left) {
data.xTranslate += -xTranslate - additionalWindow->geometry().x();
data.translate(-xTranslate - additionalWindow->geometry().x());
}
else {
data.xTranslate += xTranslate + area.width() -
additionalWindow->geometry().x() - additionalWindow->geometry().width();
data.translate(xTranslate + area.width() -
additionalWindow->geometry().x() - additionalWindow->geometry().width());
data.rotation.setOrigin(QVector3D(additionalWindow->geometry().width(), 0.0, 0.0));
}
data.opacity *= (timeLine.currentValue() - 0.5) * 2.0;
......@@ -854,34 +856,34 @@ void CoverSwitchEffect::paintWindows(const EffectWindowList& windows, bool left,
data.rotation.setAxis(Qt::YAxis);
data.rotation.setAngle(angle);
if (left)
data.xTranslate += -xTranslate + xTranslate * i / windowCount - window->geometry().x();
data.translate(-xTranslate + xTranslate * i / windowCount - window->geometry().x());
else
data.xTranslate += xTranslate + width - xTranslate * i / windowCount - window->geometry().x() - window->geometry().width();
data.translate(xTranslate + width - xTranslate * i / windowCount - window->geometry().x() - window->geometry().width());
if (animation) {
if (direction == Right) {
if ((i == windowCount - 1) && left) {
// right most window on left side -> move to front
// have to move one window distance plus half the difference between the window and the desktop size
data.xTranslate += (xTranslate / windowCount + (width - window->geometry().width()) * 0.5f) * timeLine.currentValue();
data.translate((xTranslate / windowCount + (width - window->geometry().width()) * 0.5f) * timeLine.currentValue());
data.rotation.setAngle(angle - angle * timeLine.currentValue());
}
// right most window does not have to be moved
else if (!left && (i == 0)); // do nothing
else {
// all other windows - move to next position
data.xTranslate += xTranslate / windowCount * timeLine.currentValue();
data.translate(xTranslate / windowCount * timeLine.currentValue());
}
} else {
if ((i == windowCount - 1) && !left) {
// left most window on right side -> move to front
data.xTranslate -= (xTranslate / windowCount + (width - window->geometry().width()) * 0.5f) * timeLine.currentValue();
data.translate(- (xTranslate / windowCount + (width - window->geometry().width()) * 0.5f) * timeLine.currentValue());
data.rotation.setAngle(angle - angle * timeLine.currentValue());
}
// left most window does not have to be moved
else if (i == 0 && left); // do nothing
else {
// all other windows - move to next position
data.xTranslate -= xTranslate / windowCount * timeLine.currentValue();
data.translate(- xTranslate / windowCount * timeLine.currentValue());
}
}
}
......
......@@ -747,7 +747,7 @@ void CubeEffect::paintCube(int mask, QRegion region, ScreenPaintData& data)
newData.rotation.setAxis(Qt::YAxis);
newData.rotation.setAngle(internalCubeAngle * i);
newData.rotation.setOrigin(QVector3D(rect.width() / 2, 0.0, -point));
newData.zTranslate = -zTranslate;
newData.setZTranslation(-zTranslate);
effects->paintScreen(mask, region, newData);
}
cube_painting = false;
......@@ -1355,7 +1355,7 @@ void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa
zOrdering *= timeLine.currentValue();
if (stop)
zOrdering *= (1.0 - timeLine.currentValue());
data.zTranslate += zOrdering;
data.translate(0.0, 0.0, zOrdering);
}
// check for windows belonging to the previous desktop
int prev_desktop = painting_desktop - 1;
......@@ -1377,7 +1377,7 @@ void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa
}
data.quads = new_quads;
if (shader) {
data.xTranslate = -rect.width();
data.setXTranslation(-rect.width());
} else {
data.rotation.setAxis(Qt::YAxis);
data.rotation.setOrigin(QVector3D(rect.width() - w->x(), 0.0, 0.0));
......@@ -1401,7 +1401,7 @@ void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa
}
data.quads = new_quads;
if (shader) {
data.xTranslate = rect.width();
data.setXTranslation(rect.width());
} else {
data.rotation.setAxis(Qt::YAxis);
data.rotation.setOrigin(QVector3D(-w->x(), 0.0, 0.0));
......
......@@ -301,7 +301,7 @@ void CubeSlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
if (w->x() < rect.x() &&
(direction == Left || direction == Right)) {
WindowQuadList new_quads;
data.xTranslate = rect.width();
data.setXTranslation(rect.width());
foreach (const WindowQuad & quad, data.quads) {
if (quad.right() <= -w->x()) {
new_quads.append(quad);
......@@ -312,7 +312,7 @@ void CubeSlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
if (w->x() + w->width() > rect.x() + rect.width() &&
(direction == Left || direction == Right)) {
WindowQuadList new_quads;
data.xTranslate = -rect.width();
data.setXTranslation(-rect.width());
foreach (const WindowQuad & quad, data.quads) {
if (quad.right() > rect.width() - w->x()) {
new_quads.append(quad);
......@@ -323,7 +323,7 @@ void CubeSlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
if (w->y() < rect.y() &&
(direction == Upwards || direction == Downwards)) {
WindowQuadList new_quads;
data.yTranslate = rect.height();
data.setYTranslation(rect.height());
foreach (const WindowQuad & quad, data.quads) {
if (quad.bottom() <= -w->y()) {
new_quads.append(quad);
......@@ -334,7 +334,7 @@ void CubeSlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
if (w->y() + w->height() > rect.y() + rect.height() &&
(direction == Upwards || direction == Downwards)) {
WindowQuadList new_quads;
data.yTranslate = -rect.height();
data.setYTranslation(-rect.height());
foreach (const WindowQuad & quad, data.quads) {
if (quad.bottom() > rect.height() - w->y()) {
new_quads.append(quad);
......
......@@ -192,8 +192,7 @@ void DesktopGridEffect::paintScreen(int mask, QRegion region, ScreenPaintData& d
QRect geo = m_windowMoveGeometry.translated(diff);
WindowPaintData d(windowMove);
d *= QVector2D((qreal)geo.width() / (qreal)windowMove->width(), (qreal)geo.height() / (qreal)windowMove->height());
d.xTranslate += qRound(geo.left() - windowMove->x());
d.yTranslate += qRound(geo.top() - windowMove->y());
d += QPoint(qRound(geo.left() - windowMove->x()), qRound(geo.top() - windowMove->y()));
effects->drawWindow(windowMove, PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_LANCZOS, infiniteRegion(), d);
}
......@@ -335,8 +334,7 @@ void DesktopGridEffect::paintWindow(EffectWindow* w, int mask, QRegion region, W
double progress = timeline.currentValue();
d.setXScale(interpolate(1, xScale * scale[screen] * (float)transformedGeo.width() / (float)w->geometry().width(), progress));
d.setYScale(interpolate(1, yScale * scale[screen] * (float)transformedGeo.height() / (float)w->geometry().height(), progress));
d.xTranslate += qRound(newPos.x() - w->x());
d.yTranslate += qRound(newPos.y() - w->y());
d += QPoint(qRound(newPos.x() - w->x()), qRound(newPos.y() - w->y()));
if (isUsingPresentWindows() && (w->isDock() || w->isSkipSwitcher())) {
// fade out panels if present windows is used
......
......@@ -146,8 +146,7 @@ void ExplosionEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
double scale = 1 + maxscaleadd * mWindows[w];
data.setXScale(scale);
data.setYScale(scale);
data.xTranslate += int(w->width() / 2 * (1 - scale));
data.yTranslate += int(w->height() / 2 * (1 - scale));
data.translate(int(w->width() / 2 * (1 - scale)), int(w->height() / 2 * (1 - scale)));
data.opacity *= 0.99; // Force blending
ShaderManager *manager = ShaderManager::instance();
GLShader *shader = manager->pushShader(ShaderManager::GenericShader);
......
......@@ -301,13 +301,13 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
data.saturation = info->saturation;
int distance = tempList.count() - 1;
float zDistance = 500.0f;
data.xTranslate -= (w->x() - m_screenArea.x() + data.xTranslate) * m_startStopTimeLine.currentValue();
data.xTranslate += m_screenArea.width() * m_xPosition * m_startStopTimeLine.currentValue();
data.yTranslate += (m_screenArea.y() + m_screenArea.height() * m_yPosition - (w->y() + w->height() + data.yTranslate)) * m_startStopTimeLine.currentValue();
data.translate(- (w->x() - m_screenArea.x() + data.xTranslation()) * m_startStopTimeLine.currentValue());
data.xTranslate -= (m_screenArea.width() * 0.25f) * distance * m_startStopTimeLine.currentValue();
data.yTranslate -= (m_screenArea.height() * 0.10f) * distance * m_startStopTimeLine.currentValue();
data.zTranslate -= (zDistance * distance) * m_startStopTimeLine.currentValue();
data.translate(m_screenArea.width() * m_xPosition * m_startStopTimeLine.currentValue(),
(m_screenArea.y() + m_screenArea.height() * m_yPosition - (w->y() + w->height() + data.yTranslation())) * m_startStopTimeLine.currentValue());
data.translate(- (m_screenArea.width() * 0.25f) * distance * m_startStopTimeLine.currentValue(),
- (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();
else
......@@ -353,24 +353,24 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
}
}
float zDistance = 500.0f;
data.xTranslate -= (w->x() - m_screenArea.x() + data.xTranslate) * m_startStopTimeLine.currentValue();
data.xTranslate += m_screenArea.width() * m_xPosition * m_startStopTimeLine.currentValue();
data.yTranslate += (m_screenArea.y() + m_screenArea.height() * m_yPosition - (w->y() + w->height() + data.yTranslate)) * m_startStopTimeLine.currentValue();
data.translate(- (w->x() - m_screenArea.x() + data.xTranslation()) * m_startStopTimeLine.currentValue());
data.translate(m_screenArea.width() * m_xPosition * m_startStopTimeLine.currentValue(),
(m_screenArea.y() + m_screenArea.height() * m_yPosition - (w->y() + w->height() + data.yTranslation())) * m_startStopTimeLine.currentValue());
data.xTranslate -= (m_screenArea.width() * 0.25f) * distance * m_startStopTimeLine.currentValue();
data.yTranslate -= (m_screenArea.height() * 0.10f) * distance * m_startStopTimeLine.currentValue();
data.zTranslate -= (zDistance * distance) * m_startStopTimeLine.currentValue();
data.translate(-(m_screenArea.width() * 0.25f) * distance * m_startStopTimeLine.currentValue(),
-(m_screenArea.height() * 0.10f) * distance * m_startStopTimeLine.currentValue(),
-(zDistance * distance) * m_startStopTimeLine.currentValue());
if (m_animation && !m_scheduledDirections.isEmpty()) {
if (m_scheduledDirections.head() == DirectionForward) {
data.xTranslate += (m_screenArea.width() * 0.25f) * m_timeLine.currentValue();
data.yTranslate += (m_screenArea.height() * 0.10f) * m_timeLine.currentValue();
data.zTranslate += zDistance * m_timeLine.currentValue();
data.translate((m_screenArea.width() * 0.25f) * m_timeLine.currentValue(),
(m_screenArea.height() * 0.10f) * m_timeLine.currentValue(),
zDistance * m_timeLine.currentValue());
if (distance == 0)
data.opacity *= (1.0 - m_timeLine.currentValue());
} else {
data.xTranslate -= (m_screenArea.width() * 0.25f) * m_timeLine.currentValue();
data.yTranslate -= (m_screenArea.height() * 0.10f) * m_timeLine.currentValue();
data.zTranslate -= zDistance * m_timeLine.currentValue();
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()));
......@@ -820,17 +820,17 @@ void FlipSwitchEffect::adjustWindowMultiScreen(const KWin::EffectWindow* w, Wind
QRect fullRect = effects->clientArea(FullArea, m_activeScreen, effects->currentDesktop());
if (w->screen() == m_activeScreen) {
if (clientRect.width() != fullRect.width() && clientRect.x() != fullRect.x()) {
data.xTranslate -= clientRect.x();
data.translate(- clientRect.x());
}
if (clientRect.height() != fullRect.height() && clientRect.y() != fullRect.y()) {
data.yTranslate -= clientRect.y();
data.translate(0.0, - clientRect.y());
}
} else {
if (clientRect.width() != fullRect.width() && clientRect.x() < rect.x()) {
data.xTranslate -= clientRect.width();
data.translate(- clientRect.width());
}
if (clientRect.height() != fullRect.height() && clientRect.y() < m_screenArea.y()) {
data.yTranslate -= clientRect.height();
data.translate(0.0, - clientRect.height());
}
}
}
......
......@@ -129,8 +129,7 @@ void GlideEffect::glideIn(EffectWindow* w, WindowPaintData& data)
return;
const double progress = info->timeLine->currentValue();
data *= progress;
data.xTranslate += int(w->width() / 2 * (1 - progress));
data.yTranslate += int(w->height() / 2 * (1 - progress));
data.translate(int(w->width() / 2 * (1 - progress)), int(w->height() / 2 * (1 - progress)));
}
void GlideEffect::glideOut(EffectWindow* w, WindowPaintData& data)
......@@ -140,8 +139,7 @@ void GlideEffect::glideOut(EffectWindow* w, WindowPaintData& data)
return;
const double progress = info->timeLine->currentValue();
data *= (2 - progress);
data.xTranslate -= int(w->width() / 2 * (1 - progress));
data.yTranslate -= int(w->height() / 2 * (1 - progress));
data.translate(- int(w->width() / 2 * (1 - progress)), - int(w->height() / 2 * (1 - progress)));
}
void GlideEffect::postPaintWindow(EffectWindow* w)
......
......@@ -94,8 +94,8 @@ void MinimizeAnimationEffect::paintWindow(EffectWindow* w, int mask, QRegion reg
data *= QVector2D(interpolate(1.0, icon.width() / (double)geo.width(), progress),
interpolate(1.0, icon.height() / (double)geo.height(), progress));
data.xTranslate = (int)interpolate(data.xTranslate, icon.x() - geo.x(), progress);
data.yTranslate = (int)interpolate(data.yTranslate, icon.y() - geo.y(), 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;
}
......
......@@ -379,8 +379,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region
rect.setHeight(rect.height()*scale);
data *= QVector2D(scale, scale);
data.xTranslate += tx;
data.yTranslate += ty;
data += QPoint(tx, ty);
}
}
......@@ -388,9 +387,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region
mask &= ~PAINT_WINDOW_LANCZOS;
}
if (m_dragInProgress && m_dragWindow == w) {
QPoint diff = cursorPos() - m_dragStart;
data.xTranslate += diff.x();
data.yTranslate += diff.y();
data += (cursorPos() - m_dragStart);
}
effects->paintWindow(w, mask, region, data);
......
......@@ -69,8 +69,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
{
if (m_active && w == m_resizeWindow) {
if (m_features & TextureScale) {
data.xTranslate += m_currentGeometry.x() - m_originalGeometry.x();
data.yTranslate += m_currentGeometry.y() - m_originalGeometry.y();
data += (m_currentGeometry.topLeft() - m_originalGeometry.topLeft());
data *= QVector2D(m_currentGeometry.width()/m_originalGeometry.width(),
m_currentGeometry.height()/m_originalGeometry.height());
}
......
......@@ -60,8 +60,7 @@ void ScaleInEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Windo
const qreal value = mTimeLineWindows[ w ]->currentValue();
data.opacity *= value;
data *= QVector2D(value, value);
data.xTranslate += int(w->width() / 2 * (1 - value));
data.yTranslate += int(w->height() / 2 * (1 - value));
data += QPoint(int(w->width() / 2 * (1 - value)), int(w->height() / 2 * (1 - value)));
}
effects->paintWindow(w, mask, region, data);
}
......
......@@ -108,8 +108,8 @@ void ScreenShotEffect::postPaintScreen()
}
int width = right - left;
int height = bottom - top;
d.xTranslate = -m_scheduledScreenshot->x() - left;
d.yTranslate = -m_scheduledScreenshot->y() - top;
d.setXTranslation(-m_scheduledScreenshot->x() - left);
d.setYTranslation(-m_scheduledScreenshot->y() - top);
// render window into offscreen texture
int mask = PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_TRANSLUCENT;
......
......@@ -93,7 +93,7 @@ void SheetEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowP
data.rotation.setAxis(Qt::XAxis);
data.rotation.setAngle(60.0 * (1.0 - progress));
data *= QVector3D(1.0, progress, progress);
data.yTranslate -= (w->y() - info->parentY) * (1.0 - progress);
data.translate(0.0, - (w->y() - info->parentY) * (1.0 - progress));
}
effects->paintWindow(w, mask, region, data);
}
......
......@@ -166,8 +166,7 @@ void SlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowP
if (slide) {
// don't move windows on all desktops (compensate screen transformation)
if (!w->isOnAllDesktops()) { // TODO also fix 'Workspace::movingClient'
data.xTranslate += slide_painting_diff.x();
data.yTranslate += slide_painting_diff.y();
data += slide_painting_diff;
}
}
effects->paintWindow(w, mask, region, data);
......
......@@ -195,23 +195,23 @@ void SlidingPopupsEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
int splitPoint = 0;
switch(mWindowsData[ w ].from) {
case West:
data.xTranslate -= w->width() * progress;
data.translate(- 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;
data.translate(0.0, - 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;
data.translate(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;
data.translate(0.0, w->height() * progress);
splitPoint = screenRect.y() + screenRect.height() - w->y() - start;
region = QRegion(w->x(), w->y(), w->width(), splitPoint);
}
......
......@@ -82,7 +82,7 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi
WindowPaintData thumbData(thumbw);
thumbData.opacity *= data.opacity;
QRect r, thumbRect(thumb.rect);
thumbRect.translate(w->pos() + QPoint(data.xTranslate, data.yTranslate));
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... :-(
if (effects->compositingType() == KWin::OpenGLCompositing) {
......
......@@ -269,16 +269,16 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)