Commit f36e298a authored by Martin Flöser's avatar Martin Flöser
Browse files

Less ifdef in paintWindow. CleanerCode++

Using the QMatrix4x4 allows to make everything runtime dependent
and not a compile time switch.
parent 6cf2aaf8
...@@ -1433,9 +1433,9 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP ...@@ -1433,9 +1433,9 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
int next_desktop = painting_desktop +1; int next_desktop = painting_desktop +1;
if( next_desktop > effects->numberOfDesktops() ) if( next_desktop > effects->numberOfDesktops() )
next_desktop = 1; next_desktop = 1;
#ifndef KWIN_HAVE_OPENGLES if (!shader) {
glPushMatrix(); pushMatrix();
#endif }
if( w->isOnDesktop( prev_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) ) if( w->isOnDesktop( prev_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) )
{ {
QRect rect = effects->clientArea( FullArea, activeScreen, prev_desktop); QRect rect = effects->clientArea( FullArea, activeScreen, prev_desktop);
...@@ -1448,20 +1448,22 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP ...@@ -1448,20 +1448,22 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
} }
} }
data.quads = new_quads; data.quads = new_quads;
#ifdef KWIN_HAVE_OPENGLES if (shader) {
data.xTranslate = -rect.width(); data.xTranslate = -rect.width();
#else } else {
RotationData rot = RotationData(); RotationData rot = RotationData();
rot.axis = RotationData::YAxis; rot.axis = RotationData::YAxis;
rot.xRotationPoint = rect.width() - w->x(); rot.xRotationPoint = rect.width() - w->x();
rot.angle = 360.0f / effects->numberOfDesktops(); rot.angle = 360.0f / effects->numberOfDesktops();
data.rotation = &rot; data.rotation = &rot;
float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f); float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f);
float point = rect.width()/2*tan(cubeAngle*0.5f*M_PI/180.0f); float point = rect.width()/2*tan(cubeAngle*0.5f*M_PI/180.0f);
glTranslatef( rect.width()/2, 0.0, -point ); QMatrix4x4 matrix;
glRotatef( -360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0 ); matrix.translate(rect.width()/2, 0.0, -point);
glTranslatef( -rect.width()/2, 0.0, point ); matrix.rotate(-360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0);
#endif matrix.translate(-rect.width()/2, 0.0, point);
multiplyMatrix(matrix);
}
} }
if( w->isOnDesktop( next_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) ) if( w->isOnDesktop( next_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) )
{ {
...@@ -1475,20 +1477,22 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP ...@@ -1475,20 +1477,22 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
} }
} }
data.quads = new_quads; data.quads = new_quads;
#ifdef KWIN_HAVE_OPENGLES if (shader) {
data.xTranslate = rect.width(); data.xTranslate = rect.width();
#else } else {
RotationData rot = RotationData(); RotationData rot = RotationData();
rot.axis = RotationData::YAxis; rot.axis = RotationData::YAxis;
rot.xRotationPoint = -w->x(); rot.xRotationPoint = -w->x();
rot.angle = -360.0f / effects->numberOfDesktops(); rot.angle = -360.0f / effects->numberOfDesktops();
data.rotation = &rot; data.rotation = &rot;
float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f); float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f);
float point = rect.width()/2*tan(cubeAngle*0.5f*M_PI/180.0f); float point = rect.width()/2*tan(cubeAngle*0.5f*M_PI/180.0f);
glTranslatef( rect.width()/2, 0.0, -point ); QMatrix4x4 matrix;
glRotatef( 360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0 ); matrix.translate(rect.width()/2, 0.0, -point);
glTranslatef( -rect.width()/2, 0.0, point ); matrix.rotate(360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0);
#endif matrix.translate(-rect.width()/2, 0.0, point);
multiplyMatrix(matrix);
}
} }
QRect rect = effects->clientArea( FullArea, activeScreen, painting_desktop ); QRect rect = effects->clientArea( FullArea, activeScreen, painting_desktop );
...@@ -1654,9 +1658,9 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP ...@@ -1654,9 +1658,9 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
#endif #endif
} }
} }
#ifndef KWIN_HAVE_OPENGLES if (!shader) {
glPopMatrix(); popMatrix();
#endif }
if( mode == Cylinder ) if( mode == Cylinder )
cylinderShader->unbind(); cylinderShader->unbind();
if( mode == Sphere ) if( mode == Sphere )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment