PerformPaint uses QMatrix4x4 for legacy GL.

And another piece of code get's merged between desktop GL and ES.
This commit is contained in:
Martin Gräßlin 2011-01-01 20:13:35 +01:00
parent 2e0385101a
commit e5eed55c51

View file

@ -461,12 +461,10 @@ void SceneOpenGL::Window::performPaint( int mask, QRegion region, WindowPaintDat
} }
sceneShader = true; sceneShader = true;
} }
QMatrix4x4 windowTransformation;
windowTransformation.translate(x, y);
if ((mask & PAINT_WINDOW_TRANSFORMED) || (mask & PAINT_SCREEN_TRANSFORMED)) { if ((mask & PAINT_WINDOW_TRANSFORMED) || (mask & PAINT_SCREEN_TRANSFORMED)) {
x += data.xTranslate; windowTransformation.translate(data.xTranslate, data.yTranslate, data.zTranslate);
y += data.yTranslate;
z += data.zTranslate;
QMatrix4x4 windowTransformation;
windowTransformation.translate(x, y, z);
if ((mask & PAINT_WINDOW_TRANSFORMED ) && ( data.xScale != 1 || data.yScale != 1 || data.zScale != 1)) { if ((mask & PAINT_WINDOW_TRANSFORMED ) && ( data.xScale != 1 || data.yScale != 1 || data.zScale != 1)) {
windowTransformation.scale(data.xScale, data.yScale, data.zScale); windowTransformation.scale(data.xScale, data.yScale, data.zScale);
} }
@ -496,33 +494,7 @@ void SceneOpenGL::Window::performPaint( int mask, QRegion region, WindowPaintDat
} }
if( !sceneShader ) if( !sceneShader )
{ {
#ifndef KWIN_HAVE_OPENGLES pushMatrix(windowTransformation);
glPushMatrix();
glTranslatef( x, y, z );
if(( mask & PAINT_WINDOW_TRANSFORMED ) && ( data.xScale != 1 || data.yScale != 1 || data.zScale != 1 ))
glScalef( data.xScale, data.yScale, data.zScale );
if(( mask & PAINT_WINDOW_TRANSFORMED ) && data.rotation )
{
glTranslatef( data.rotation->xRotationPoint, data.rotation->yRotationPoint, data.rotation->zRotationPoint );
float xAxis = 0.0;
float yAxis = 0.0;
float zAxis = 0.0;
switch( data.rotation->axis )
{
case RotationData::XAxis:
xAxis = 1.0;
break;
case RotationData::YAxis:
yAxis = 1.0;
break;
case RotationData::ZAxis:
zAxis = 1.0;
break;
}
glRotatef( data.rotation->angle, xAxis, yAxis, zAxis );
glTranslatef( -data.rotation->xRotationPoint, -data.rotation->yRotationPoint, -data.rotation->zRotationPoint );
}
#endif
} }
region.translate( toplevel->x(), toplevel->y() ); // Back to screen coords region.translate( toplevel->x(), toplevel->y() ); // Back to screen coords
@ -625,10 +597,9 @@ void SceneOpenGL::Window::performPaint( int mask, QRegion region, WindowPaintDat
ShaderManager::instance()->popShader(); ShaderManager::instance()->popShader();
data.shader = NULL; data.shader = NULL;
} }
#ifndef KWIN_HAVE_OPENGLES else {
else popMatrix();
glPopMatrix(); }
#endif
} }
void SceneOpenGL::Window::paintDecoration( const QPixmap* decoration, TextureType decorationType, const QRegion& region, const QRect& rect, const WindowPaintData& data, const WindowQuadList& quads, bool updateDeco ) void SceneOpenGL::Window::paintDecoration( const QPixmap* decoration, TextureType decorationType, const QRegion& region, const QRect& rect, const WindowPaintData& data, const WindowQuadList& quads, bool updateDeco )