From 5185fe81cf8a5163ca83d156b9ff34656cc8da58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 10 Jul 2014 13:35:36 +0200 Subject: [PATCH] make trackmouse FX account paintdata scale/trans REVIEW: 118537 CCBUG: 333012 cherry-picked from kde-workspace e9919695e57612055acfc685707210c00a42ce00. Original author: luebking --- effects/trackmouse/trackmouse.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/effects/trackmouse/trackmouse.cpp b/effects/trackmouse/trackmouse.cpp index ea3e02677e..436ace18e1 100644 --- a/effects/trackmouse/trackmouse.cpp +++ b/effects/trackmouse/trackmouse.cpp @@ -134,10 +134,12 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); QMatrix4x4 matrix(modelview); const QPointF p = m_lastRect[0].topLeft() + QPoint(m_lastRect[0].width()/2.0, m_lastRect[0].height()/2.0); + const float x = p.x()*data.xScale() + data.xTranslation(); + const float y = p.y()*data.yScale() + data.yTranslation(); for (int i = 0; i < 2; ++i) { - matrix.translate(p.x(), p.y(), 0.0); + matrix.translate(x, y, 0.0); matrix.rotate(i ? -2*m_angle : m_angle, 0, 0, 1.0); - matrix.translate(-p.x(), -p.y(), 0.0); + matrix.translate(-x, -y, 0.0); shader->setUniform(GLShader::ModelViewMatrix, matrix); shader->setUniform(GLShader::Saturation, 1.0); shader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0)); @@ -169,7 +171,9 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da const QRect &rect = m_lastRect[i]; xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_OVER, picture, XCB_RENDER_PICTURE_NONE, effects->xrenderBufferPicture(), 0, 0, 0, 0, - rect.x(), rect.y(), rect.width(), rect.height()); + qRound((rect.x()+rect.width()/2.0)*data.xScale() - rect.width()/2.0 + data.xTranslation()), + qRound((rect.y()+rect.height()/2.0)*data.yScale() - rect.height()/2.0 + data.yTranslation()), + rect.width(), rect.height()); } } #endif