make trackmouse FX account paintdata scale/trans

REVIEW: 118537
CCBUG: 333012

cherry-picked from kde-workspace
e9919695e57612055acfc685707210c00a42ce00.

Original author: luebking
This commit is contained in:
Martin Gräßlin 2014-07-10 13:35:36 +02:00
parent e231be7c7c
commit 5185fe81cf

View file

@ -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