Replace translation by QVector3D in Screen/Window PaintData
This commit is contained in:
parent
0eff12eb92
commit
a2b0d42916
26 changed files with 387 additions and 154 deletions
|
@ -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)
|
|||
// mouse-tracking allows navigation of the zoom-area using the mouse.
|
||||
switch(mouseTracking) {
|
||||
case MouseTrackingProportional:
|
||||
data.xTranslate = - int(cursorPoint.x() * (zoom - 1.0));
|
||||
data.yTranslate = - int(cursorPoint.y() * (zoom - 1.0));
|
||||
data.setXTranslation(- int(cursorPoint.x() * (zoom - 1.0)));
|
||||
data.setYTranslation(- int(cursorPoint.y() * (zoom - 1.0)));
|
||||
prevPoint = cursorPoint;
|
||||
break;
|
||||
case MouseTrackingCentred:
|
||||
prevPoint = cursorPoint;
|
||||
// fall through
|
||||
case MouseTrackingDisabled:
|
||||
data.xTranslate = qMin(0, qMax(int(displayWidth() - displayWidth() * zoom), int(displayWidth() / 2 - prevPoint.x() * zoom)));
|
||||
data.yTranslate = qMin(0, qMax(int(displayHeight() - displayHeight() * zoom), int(displayHeight() / 2 - prevPoint.y() * zoom)));
|
||||
data.setXTranslation(qMin(0, qMax(int(displayWidth() - displayWidth() * zoom), int(displayWidth() / 2 - prevPoint.x() * zoom))));
|
||||
data.setYTranslation(qMin(0, qMax(int(displayHeight() - displayHeight() * zoom), int(displayHeight() / 2 - prevPoint.y() * zoom))));
|
||||
break;
|
||||
case MouseTrackingPush:
|
||||
if (timeline.state() != QTimeLine::Running) {
|
||||
|
@ -301,8 +301,8 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
|
|||
timeline.start();
|
||||
}
|
||||
}
|
||||
data.xTranslate = - int(prevPoint.x() * (zoom - 1.0));
|
||||
data.yTranslate = - int(prevPoint.y() * (zoom - 1.0));
|
||||
data.setXTranslation(- int(prevPoint.x() * (zoom - 1.0)));
|
||||
data.setYTranslation(- int(prevPoint.y() * (zoom - 1.0)));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -316,8 +316,8 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
|
|||
acceptFocus = msecs > focusDelay;
|
||||
}
|
||||
if (acceptFocus) {
|
||||
data.xTranslate = - int(focusPoint.x() * (zoom - 1.0));
|
||||
data.yTranslate = - int(focusPoint.y() * (zoom - 1.0));
|
||||
data.setXTranslation(- int(focusPoint.x() * (zoom - 1.0)));
|
||||
data.setYTranslation(- int(focusPoint.y() * (zoom - 1.0)));
|
||||
prevPoint = focusPoint;
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
|
|||
h *= zoom;
|
||||
}
|
||||
QPoint p = QCursor::pos();
|
||||
QRect rect(p.x() * zoom + data.xTranslate, p.y() * zoom + data.yTranslate, w, h);
|
||||
QRect rect(p.x() * zoom + data.xTranslation(), p.y() * zoom + data.yTranslation(), w, h);
|
||||
|
||||
if (texture) {
|
||||
texture->bind();
|
||||
|
|
|
@ -186,8 +186,8 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region,
|
|||
width = w->width();
|
||||
height = w->height();
|
||||
}
|
||||
int tx = data.xTranslate + w->x() + left * data.xScale();
|
||||
int ty = data.yTranslate + w->y() + top * data.yScale();
|
||||
int tx = data.xTranslation() + w->x() + left * data.xScale();
|
||||
int ty = data.yTranslation() + w->y() + top * data.yScale();
|
||||
int tw = width * data.xScale();
|
||||
int th = height * data.yScale();
|
||||
const QRect textureRect(tx, ty, tw, th);
|
||||
|
@ -242,8 +242,8 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region,
|
|||
WindowPaintData thumbData = data;
|
||||
thumbData.setXScale(1.0);
|
||||
thumbData.setYScale(1.0);
|
||||
thumbData.xTranslate = -w->x() - left;
|
||||
thumbData.yTranslate = -w->y() - top;
|
||||
thumbData.setXTranslation(-w->x() - left);
|
||||
thumbData.setYTranslation(-w->y() - top);
|
||||
thumbData.brightness = 1.0;
|
||||
thumbData.opacity = 1.0;
|
||||
thumbData.saturation = 1.0;
|
||||
|
|
|
@ -407,7 +407,7 @@ void AnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
|
|||
if (anim->from[0] >= 0.0 && anim->to[0] >= 0.0) { // scale x
|
||||
f1 = interpolated(*anim, 0);
|
||||
f2 = geometryCompensation( anim->meta & AnimationEffect::Horizontal, f1 );
|
||||
data.xTranslate += f2 * sz.width();
|
||||
data.translate(f2 * sz.width());
|
||||
data.setXScale(data.xScale() * f1);
|
||||
}
|
||||
if (anim->from[1] >= 0.0 && anim->to[1] >= 0.0) { // scale y
|
||||
|
@ -417,7 +417,7 @@ void AnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
|
|||
}
|
||||
else if ( ((anim->meta & AnimationEffect::Vertical)>>1) != (anim->meta & AnimationEffect::Horizontal) )
|
||||
f2 = geometryCompensation( anim->meta & AnimationEffect::Vertical, f1 );
|
||||
data.yTranslate += f2 * sz.height();
|
||||
data.translate(0.0, f2 * sz.height());
|
||||
data.setYScale(data.yScale() * f1);
|
||||
}
|
||||
break;
|
||||
|
@ -426,8 +426,7 @@ void AnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
|
|||
region = clipRect(w->expandedGeometry(), *anim);
|
||||
break;
|
||||
case Translation:
|
||||
data.xTranslate += interpolated(*anim, 0);
|
||||
data.yTranslate += interpolated(*anim, 1);
|
||||
data += QPointF(interpolated(*anim, 0), interpolated(*anim, 1));
|
||||
break;
|
||||
case Size: {
|
||||
FPx2 dest = anim->from + progress(*anim) * (anim->to - anim->from);
|
||||
|
@ -435,12 +434,12 @@ void AnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
|
|||
float f;
|
||||
if (anim->from[0] >= 0.0 && anim->to[0] >= 0.0) { // resize x
|
||||
f = dest[0]/sz.width();
|
||||
data.xTranslate += geometryCompensation( anim->meta & AnimationEffect::Horizontal, f ) * sz.width();
|
||||
data.translate(geometryCompensation( anim->meta & AnimationEffect::Horizontal, f ) * sz.width());
|
||||
data.setXScale(data.xScale() * f);
|
||||
}
|
||||
if (anim->from[1] >= 0.0 && anim->to[1] >= 0.0) { // resize y
|
||||
f = dest[1]/sz.height();
|
||||
data.yTranslate += geometryCompensation( anim->meta & AnimationEffect::Vertical, f ) * sz.height();
|
||||
data.translate(0.0, geometryCompensation( anim->meta & AnimationEffect::Vertical, f ) * sz.height());
|
||||
data.setYScale(data.yScale() * f);
|
||||
}
|
||||
break;
|
||||
|
@ -452,13 +451,13 @@ void AnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
|
|||
float dest = interpolated(*anim, 0);
|
||||
const int x[2] = { xCoord(geo, metaData(SourceAnchor, anim->meta)),
|
||||
xCoord(geo, metaData(TargetAnchor, anim->meta)) };
|
||||
data.xTranslate += dest - (x[0] + prgrs*(x[1] - x[0]));
|
||||
data.translate(dest - (x[0] + prgrs*(x[1] - x[0])));
|
||||
}
|
||||
if ( anim->from[1] >= 0.0 && anim->to[1] >= 0.0 ) {
|
||||
float dest = interpolated(*anim, 1);
|
||||
const int y[2] = { yCoord(geo, metaData(SourceAnchor, anim->meta)),
|
||||
yCoord(geo, metaData(TargetAnchor, anim->meta)) };
|
||||
data.yTranslate += dest - (y[0] + prgrs*(y[1] - y[0]));
|
||||
data.translate(0.0, dest - (y[0] + prgrs*(y[1] - y[0])));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -65,9 +65,6 @@ WindowPaintData::WindowPaintData(EffectWindow* w)
|
|||
: opacity(w->opacity())
|
||||
, contents_opacity(1.0)
|
||||
, decoration_opacity(1.0)
|
||||
, xTranslate(0)
|
||||
, yTranslate(0)
|
||||
, zTranslate(0)
|
||||
, saturation(1)
|
||||
, brightness(1)
|
||||
, shader(NULL)
|
||||
|
@ -79,13 +76,11 @@ WindowPaintData::WindowPaintData(const WindowPaintData &other)
|
|||
: opacity(other.opacity)
|
||||
, contents_opacity(other.contents_opacity)
|
||||
, decoration_opacity(other.decoration_opacity)
|
||||
, xTranslate(other.xTranslate)
|
||||
, yTranslate(other.yTranslate)
|
||||
, zTranslate(other.zTranslate)
|
||||
, saturation(other.saturation)
|
||||
, brightness(other.brightness)
|
||||
, quads(other.quads)
|
||||
, shader(other.shader)
|
||||
, m_translation(other.translation())
|
||||
{
|
||||
m_scale.setXScale(other.xScale());
|
||||
m_scale.setYScale(other.yScale());
|
||||
|
@ -118,6 +113,27 @@ WindowPaintData &WindowPaintData::operator*=(const QVector3D &scale)
|
|||
return *this;
|
||||
}
|
||||
|
||||
WindowPaintData &WindowPaintData::operator+=(const QPointF &translation)
|
||||
{
|
||||
return this->operator+=(QVector3D(translation));
|
||||
}
|
||||
|
||||
WindowPaintData &WindowPaintData::operator+=(const QPoint &translation)
|
||||
{
|
||||
return this->operator+=(QVector3D(translation));
|
||||
}
|
||||
|
||||
WindowPaintData &WindowPaintData::operator+=(const QVector2D &translation)
|
||||
{
|
||||
return this->operator+=(QVector3D(translation));
|
||||
}
|
||||
|
||||
WindowPaintData &WindowPaintData::operator+=(const QVector3D &translation)
|
||||
{
|
||||
this->m_translation += translation;
|
||||
return *this;
|
||||
}
|
||||
|
||||
qreal WindowPaintData::xScale() const
|
||||
{
|
||||
return this->m_scale.xScale();
|
||||
|
@ -166,17 +182,57 @@ const QGraphicsScale &WindowPaintData::scale() const
|
|||
return m_scale;
|
||||
}
|
||||
|
||||
void WindowPaintData::setXTranslation(qreal translate)
|
||||
{
|
||||
this->m_translation.setX(translate);
|
||||
}
|
||||
|
||||
void WindowPaintData::setYTranslation(qreal translate)
|
||||
{
|
||||
this->m_translation.setY(translate);
|
||||
}
|
||||
|
||||
void WindowPaintData::setZTranslation(qreal translate)
|
||||
{
|
||||
this->m_translation.setZ(translate);
|
||||
}
|
||||
|
||||
void WindowPaintData::translate(qreal x, qreal y, qreal z)
|
||||
{
|
||||
this->operator+=(QVector3D(x, y, z));
|
||||
}
|
||||
|
||||
void WindowPaintData::translate(const QVector3D &translate)
|
||||
{
|
||||
this->operator+=(translate);
|
||||
}
|
||||
|
||||
qreal WindowPaintData::xTranslation() const
|
||||
{
|
||||
return m_translation.x();
|
||||
}
|
||||
|
||||
qreal WindowPaintData::yTranslation() const
|
||||
{
|
||||
return m_translation.y();
|
||||
}
|
||||
|
||||
qreal WindowPaintData::zTranslation() const
|
||||
{
|
||||
return m_translation.z();
|
||||
}
|
||||
|
||||
const QVector3D &WindowPaintData::translation() const
|
||||
{
|
||||
return m_translation;
|
||||
}
|
||||
|
||||
ScreenPaintData::ScreenPaintData()
|
||||
: xTranslate(0)
|
||||
, yTranslate(0)
|
||||
, zTranslate(0)
|
||||
{
|
||||
}
|
||||
|
||||
ScreenPaintData::ScreenPaintData(const ScreenPaintData &other)
|
||||
: xTranslate(other.xTranslate)
|
||||
, yTranslate(other.yTranslate)
|
||||
, zTranslate(other.zTranslate)
|
||||
: m_translation(other.translation())
|
||||
{
|
||||
m_scale.setXScale(other.xScale());
|
||||
m_scale.setYScale(other.yScale());
|
||||
|
@ -191,9 +247,9 @@ ScreenPaintData &ScreenPaintData::operator=(const ScreenPaintData &rhs)
|
|||
this->m_scale.setXScale(rhs.xScale());
|
||||
this->m_scale.setYScale(rhs.yScale());
|
||||
this->m_scale.setZScale(rhs.zScale());
|
||||
this->xTranslate = rhs.xTranslate;
|
||||
this->yTranslate = rhs.yTranslate;
|
||||
this->zTranslate = rhs.zTranslate;
|
||||
this->m_translation.setX(rhs.xTranslation());
|
||||
this->m_translation.setY(rhs.yTranslation());
|
||||
this->m_translation.setZ(rhs.zTranslation());
|
||||
this->rotation.setOrigin(rhs.rotation.origin());
|
||||
this->rotation.setAxis(rhs.rotation.axis());
|
||||
this->rotation.setAngle(rhs.rotation.angle());
|
||||
|
@ -223,6 +279,27 @@ ScreenPaintData &ScreenPaintData::operator*=(const QVector3D &scale)
|
|||
return *this;
|
||||
}
|
||||
|
||||
ScreenPaintData &ScreenPaintData::operator+=(const QPointF &translation)
|
||||
{
|
||||
return this->operator+=(QVector3D(translation));
|
||||
}
|
||||
|
||||
ScreenPaintData &ScreenPaintData::operator+=(const QPoint &translation)
|
||||
{
|
||||
return this->operator+=(QVector3D(translation));
|
||||
}
|
||||
|
||||
ScreenPaintData &ScreenPaintData::operator+=(const QVector2D &translation)
|
||||
{
|
||||
return this->operator+=(QVector3D(translation));
|
||||
}
|
||||
|
||||
ScreenPaintData &ScreenPaintData::operator+=(const QVector3D &translation)
|
||||
{
|
||||
m_translation += translation;
|
||||
return *this;
|
||||
}
|
||||
|
||||
qreal ScreenPaintData::xScale() const
|
||||
{
|
||||
return m_scale.xScale();
|
||||
|
@ -271,6 +348,46 @@ const QGraphicsScale &ScreenPaintData::scale() const
|
|||
return this->m_scale;
|
||||
}
|
||||
|
||||
void ScreenPaintData::setXTranslation(qreal translate)
|
||||
{
|
||||
m_translation.setX(translate);
|
||||
}
|
||||
|
||||
void ScreenPaintData::setYTranslation(qreal translate)
|
||||
{
|
||||
m_translation.setY(translate);
|
||||
}
|
||||
|
||||
void ScreenPaintData::setZTranslation(qreal translate)
|
||||
{
|
||||
m_translation.setZ(translate);
|
||||
}
|
||||
|
||||
void ScreenPaintData::translate(qreal x, qreal y, qreal z)
|
||||
{
|
||||
this->operator+=(QVector3D(x, y, z));
|
||||
}
|
||||
|
||||
qreal ScreenPaintData::xTranslation() const
|
||||
{
|
||||
return m_translation.x();
|
||||
}
|
||||
|
||||
qreal ScreenPaintData::yTranslation() const
|
||||
{
|
||||
return m_translation.y();
|
||||
}
|
||||
|
||||
qreal ScreenPaintData::zTranslation() const
|
||||
{
|
||||
return m_translation.z();
|
||||
}
|
||||
|
||||
const QVector3D &ScreenPaintData::translation() const
|
||||
{
|
||||
return m_translation;
|
||||
}
|
||||
|
||||
//****************************************
|
||||
// Effect
|
||||
//****************************************
|
||||
|
@ -372,8 +489,8 @@ void Effect::setPositionTransformations(WindowPaintData& data, QRect& region, Ef
|
|||
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 - w->x();
|
||||
data.yTranslate = y - w->y();
|
||||
data.setXTranslation(x - w->x());
|
||||
data.setYTranslation(y - w->y());
|
||||
}
|
||||
|
||||
int Effect::displayWidth()
|
||||
|
@ -1255,8 +1372,7 @@ void WindowMotionManager::apply(EffectWindow *w, WindowPaintData &data)
|
|||
|
||||
// TODO: Take into account existing scale so that we can work with multiple managers (E.g. Present windows + grid)
|
||||
WindowMotion *motion = &it.value();
|
||||
data.xTranslate += motion->translation.value().x() - w->x();
|
||||
data.yTranslate += motion->translation.value().y() - w->y();
|
||||
data += (motion->translation.value() - QPointF(w->x(), w->y()));
|
||||
data *= QVector2D(motion->scale.value());
|
||||
}
|
||||
|
||||
|
|
|
@ -1672,6 +1672,29 @@ public:
|
|||
* @since 4.10
|
||||
**/
|
||||
WindowPaintData& operator*=(const QVector3D &scale);
|
||||
/**
|
||||
* Translates the window by the given @p translation and returns a reference to the ScreenPaintData.
|
||||
* @since 4.10
|
||||
**/
|
||||
WindowPaintData& operator+=(const QPointF &translation);
|
||||
/**
|
||||
* Translates the window by the given @p translation and returns a reference to the ScreenPaintData.
|
||||
* Overloaded method for convenience.
|
||||
* @since 4.10
|
||||
**/
|
||||
WindowPaintData& operator+=(const QPoint &translation);
|
||||
/**
|
||||
* Translates the window by the given @p translation and returns a reference to the ScreenPaintData.
|
||||
* Overloaded method for convenience.
|
||||
* @since 4.10
|
||||
**/
|
||||
WindowPaintData& operator+=(const QVector2D &translation);
|
||||
/**
|
||||
* Translates the window by the given @p translation and returns a reference to the ScreenPaintData.
|
||||
* Overloaded method for convenience.
|
||||
* @since 4.10
|
||||
**/
|
||||
WindowPaintData& operator+=(const QVector3D &translation);
|
||||
/**
|
||||
* @returns scale factor in X direction.
|
||||
* @since 4.10
|
||||
|
@ -1718,6 +1741,52 @@ public:
|
|||
**/
|
||||
void setScale(const QVector3D &scale);
|
||||
const QGraphicsScale &scale() const;
|
||||
const QVector3D &translation() const;
|
||||
/**
|
||||
* @returns the translation in X direction.
|
||||
* @since 4.10
|
||||
**/
|
||||
qreal xTranslation() const;
|
||||
/**
|
||||
* @returns the translation in Y direction.
|
||||
* @since 4.10
|
||||
**/
|
||||
qreal yTranslation() const;
|
||||
/**
|
||||
* @returns the translation in Z direction.
|
||||
* @since 4.10
|
||||
**/
|
||||
qreal zTranslation() const;
|
||||
/**
|
||||
* Sets the translation in X direction to @p translate.
|
||||
* @since 4.10
|
||||
**/
|
||||
void setXTranslation(qreal translate);
|
||||
/**
|
||||
* Sets the translation in Y direction to @p translate.
|
||||
* @since 4.10
|
||||
**/
|
||||
void setYTranslation(qreal translate);
|
||||
/**
|
||||
* Sets the translation in Z direction to @p translate.
|
||||
* @since 4.10
|
||||
**/
|
||||
void setZTranslation(qreal translate);
|
||||
/**
|
||||
* Translates the window.
|
||||
* @param x Translation in X direction
|
||||
* @param y Translation in Y direction
|
||||
* @param z Translation in Z direction
|
||||
* @since 4.10
|
||||
**/
|
||||
void translate(qreal x, qreal y = 0.0, qreal z = 0.0);
|
||||
/**
|
||||
* Translates the window.
|
||||
* Overloaded method for convenience.
|
||||
* @param translate The translation
|
||||
* @since 4.10
|
||||
**/
|
||||
void translate(const QVector3D &translate);
|
||||
/**
|
||||
* Window opacity, in range 0 = transparent to 1 = fully opaque
|
||||
* Opacity for contents is opacity*contents_opacity, the same
|
||||
|
@ -1726,9 +1795,6 @@ public:
|
|||
double opacity;
|
||||
double contents_opacity;
|
||||
double decoration_opacity;
|
||||
int xTranslate;
|
||||
int yTranslate;
|
||||
double zTranslate;
|
||||
/**
|
||||
* Saturation of the window, in range [0; 1]
|
||||
* 1 means that the window is unchanged, 0 means that it's completely
|
||||
|
@ -1752,6 +1818,7 @@ public:
|
|||
QGraphicsRotation rotation;
|
||||
private:
|
||||
QGraphicsScale m_scale;
|
||||
QVector3D m_translation;
|
||||
};
|
||||
|
||||
class KWIN_EXPORT ScreenPaintData
|
||||
|
@ -1777,6 +1844,29 @@ public:
|
|||
* @since 4.10
|
||||
**/
|
||||
ScreenPaintData& operator*=(const QVector3D &scale);
|
||||
/**
|
||||
* Translates the screen by the given @p translation and returns a reference to the ScreenPaintData.
|
||||
* @since 4.10
|
||||
**/
|
||||
ScreenPaintData& operator+=(const QPointF &translation);
|
||||
/**
|
||||
* Translates the screen by the given @p translation and returns a reference to the ScreenPaintData.
|
||||
* Overloaded method for convenience.
|
||||
* @since 4.10
|
||||
**/
|
||||
ScreenPaintData& operator+=(const QPoint &translation);
|
||||
/**
|
||||
* Translates the screen by the given @p translation and returns a reference to the ScreenPaintData.
|
||||
* Overloaded method for convenience.
|
||||
* @since 4.10
|
||||
**/
|
||||
ScreenPaintData& operator+=(const QVector2D &translation);
|
||||
/**
|
||||
* Translates the screen by the given @p translation and returns a reference to the ScreenPaintData.
|
||||
* Overloaded method for convenience.
|
||||
* @since 4.10
|
||||
**/
|
||||
ScreenPaintData& operator+=(const QVector3D &translation);
|
||||
/**
|
||||
* @returns scale factor in X direction.
|
||||
* @since 4.10
|
||||
|
@ -1823,13 +1913,50 @@ public:
|
|||
**/
|
||||
void setScale(const QVector3D &scale);
|
||||
const QGraphicsScale &scale() const;
|
||||
int xTranslate;
|
||||
int yTranslate;
|
||||
double zTranslate;
|
||||
const QVector3D &translation() const;
|
||||
/**
|
||||
* @returns the translation in X direction.
|
||||
* @since 4.10
|
||||
**/
|
||||
qreal xTranslation() const;
|
||||
/**
|
||||
* @returns the translation in Y direction.
|
||||
* @since 4.10
|
||||
**/
|
||||
qreal yTranslation() const;
|
||||
/**
|
||||
* @returns the translation in Z direction.
|
||||
* @since 4.10
|
||||
**/
|
||||
qreal zTranslation() const;
|
||||
/**
|
||||
* Sets the translation in X direction to @p translate.
|
||||
* @since 4.10
|
||||
**/
|
||||
void setXTranslation(qreal translate);
|
||||
/**
|
||||
* Sets the translation in Y direction to @p translate.
|
||||
* @since 4.10
|
||||
**/
|
||||
void setYTranslation(qreal translate);
|
||||
/**
|
||||
* Sets the translation in Z direction to @p translate.
|
||||
* @since 4.10
|
||||
**/
|
||||
void setZTranslation(qreal translate);
|
||||
/**
|
||||
* Translates the screen.
|
||||
* @param x Translation in X direction
|
||||
* @param y Translation in Y direction
|
||||
* @param z Translation in Z direction
|
||||
* @since 4.10
|
||||
**/
|
||||
void translate(qreal x, qreal y = 0.0, qreal z = 0.0);
|
||||
QGraphicsRotation rotation;
|
||||
ScreenPaintData& operator=(const ScreenPaintData &rhs);
|
||||
private:
|
||||
QGraphicsScale m_scale;
|
||||
QVector3D m_translation;
|
||||
};
|
||||
|
||||
class KWIN_EXPORT ScreenPrePaintData
|
||||
|
|
|
@ -406,8 +406,8 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad
|
|||
const QPoint point = viewPos + declview->mapFromScene(item->scenePos());
|
||||
const qreal x = point.x() + w->x() + (item->width() - size.width())/2;
|
||||
const qreal y = point.y() + w->y() + (item->height() - size.height()) / 2;
|
||||
thumbData.xTranslate = x - thumb->x();
|
||||
thumbData.yTranslate = y - thumb->y();
|
||||
thumbData.setXTranslation(x - thumb->x());
|
||||
thumbData.setYTranslation(y - thumb->y());
|
||||
int thumbMask = PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_LANCZOS;
|
||||
if (thumbData.opacity == 1.0) {
|
||||
thumbMask |= PAINT_WINDOW_OPAQUE;
|
||||
|
|
|
@ -133,7 +133,7 @@ QMatrix4x4 SceneOpenGL::transformation(int mask, const ScreenPaintData &data) co
|
|||
if (!(mask & PAINT_SCREEN_TRANSFORMED))
|
||||
return matrix;
|
||||
|
||||
matrix.translate(data.xTranslate, data.yTranslate, data.zTranslate);
|
||||
matrix.translate(data.translation());
|
||||
data.scale().applyTo(&matrix);
|
||||
|
||||
if (data.rotation.angle() == 0.0)
|
||||
|
@ -416,7 +416,7 @@ QMatrix4x4 SceneOpenGL::Window::transformation(int mask, const WindowPaintData &
|
|||
if (!(mask & PAINT_WINDOW_TRANSFORMED))
|
||||
return matrix;
|
||||
|
||||
matrix.translate(data.xTranslate, data.yTranslate, data.zTranslate);
|
||||
matrix.translate(data.translation());
|
||||
data.scale().applyTo(&matrix);
|
||||
|
||||
if (data.rotation.angle() == 0.0)
|
||||
|
|
|
@ -373,8 +373,8 @@ QRect SceneXrender::Window::mapToScreen(int mask, const WindowPaintData &data, c
|
|||
|
||||
if (mask & PAINT_WINDOW_TRANSFORMED) {
|
||||
// Apply the window transformation
|
||||
r.moveTo(r.x() * data.xScale() + data.xTranslate,
|
||||
r.y() * data.yScale() + data.yTranslate);
|
||||
r.moveTo(r.x() * data.xScale() + data.xTranslation(),
|
||||
r.y() * data.yScale() + data.yTranslation());
|
||||
r.setWidth(r.width() * data.xScale());
|
||||
r.setHeight(r.height() * data.yScale());
|
||||
}
|
||||
|
@ -384,8 +384,8 @@ QRect SceneXrender::Window::mapToScreen(int mask, const WindowPaintData &data, c
|
|||
|
||||
if (mask & PAINT_SCREEN_TRANSFORMED) {
|
||||
// Apply the screen transformation
|
||||
r.moveTo(r.x() * screen_paint.xScale() + screen_paint.xTranslate,
|
||||
r.y() * screen_paint.yScale() + screen_paint.yTranslate);
|
||||
r.moveTo(r.x() * screen_paint.xScale() + screen_paint.xTranslation(),
|
||||
r.y() * screen_paint.yScale() + screen_paint.yTranslation());
|
||||
r.setWidth(r.width() * screen_paint.xScale());
|
||||
r.setHeight(r.height() * screen_paint.yScale());
|
||||
}
|
||||
|
@ -400,8 +400,8 @@ QPoint SceneXrender::Window::mapToScreen(int mask, const WindowPaintData &data,
|
|||
|
||||
if (mask & PAINT_WINDOW_TRANSFORMED) {
|
||||
// Apply the window transformation
|
||||
pt.rx() = pt.x() * data.xScale() + data.xTranslate;
|
||||
pt.ry() = pt.y() * data.yScale() + data.yTranslate;
|
||||
pt.rx() = pt.x() * data.xScale() + data.xTranslation();
|
||||
pt.ry() = pt.y() * data.yScale() + data.yTranslation();
|
||||
}
|
||||
|
||||
// Move the point to the screen position
|
||||
|
@ -409,8 +409,8 @@ QPoint SceneXrender::Window::mapToScreen(int mask, const WindowPaintData &data,
|
|||
|
||||
if (mask & PAINT_SCREEN_TRANSFORMED) {
|
||||
// Apply the screen transformation
|
||||
pt.rx() = pt.x() * screen_paint.xScale() + screen_paint.xTranslate;
|
||||
pt.ry() = pt.y() * screen_paint.yScale() + screen_paint.yTranslate;
|
||||
pt.rx() = pt.x() * screen_paint.xScale() + screen_paint.xTranslation();
|
||||
pt.ry() = pt.y() * screen_paint.yScale() + screen_paint.yTranslation();
|
||||
}
|
||||
|
||||
return pt;
|
||||
|
|
Loading…
Reference in a new issue