Optimize logout vignetting and increase its resolution.
svn path=/trunk/KDE/kdebase/workspace/; revision=1051774
This commit is contained in:
parent
d5d0e8762a
commit
1b80aec136
1 changed files with 12 additions and 25 deletions
|
@ -236,35 +236,22 @@ void LogoutEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data
|
||||||
|
|
||||||
// Vignetting (Radial gradient with transparent middle and black edges)
|
// Vignetting (Radial gradient with transparent middle and black edges)
|
||||||
for( int screen = 0; screen < effects->numScreens(); screen++ )
|
for( int screen = 0; screen < effects->numScreens(); screen++ )
|
||||||
{ // TODO: Cache
|
{
|
||||||
QRect screenGeom = effects->clientArea( ScreenArea, screen, 0 );
|
QRect screenGeom = effects->clientArea( ScreenArea, screen, 0 );
|
||||||
glScissor( screenGeom.x(), displayHeight() - screenGeom.y() - screenGeom.height(),
|
glScissor( screenGeom.x(), displayHeight() - screenGeom.y() - screenGeom.height(),
|
||||||
screenGeom.width(), screenGeom.height() ); // GL coords are flipped
|
screenGeom.width(), screenGeom.height() ); // GL coords are flipped
|
||||||
glEnable( GL_SCISSOR_TEST ); // Geom must be set before enable
|
glEnable( GL_SCISSOR_TEST ); // Geom must be set before enable
|
||||||
float ro = float(( screenGeom.width() > screenGeom.height() )
|
const float cenX = screenGeom.x() + screenGeom.width() / 2;
|
||||||
? screenGeom.width() : screenGeom.height() ) * 0.8f; // Outer radius
|
const float cenY = screenGeom.y() + screenGeom.height() / 2;
|
||||||
glBegin( GL_TRIANGLES );
|
const float a = M_PI / 16.0f; // Angle of increment
|
||||||
const float a = M_PI / 8.0f; // Angle of increment
|
const float r = float(( screenGeom.width() > screenGeom.height() )
|
||||||
for( float i = 0.0f; i < M_PI * 1.99f; i += a )
|
? screenGeom.width() : screenGeom.height() ) * 0.8f; // Radius
|
||||||
{
|
glBegin( GL_TRIANGLE_FAN );
|
||||||
float x, y;
|
glColor4f( 0.0f, 0.0f, 0.0f, 0.0f );
|
||||||
|
glVertex3f( cenX, cenY, 0.0f );
|
||||||
glColor4f( 0.0f, 0.0f, 0.0f, 0.0f );
|
glColor4f( 0.0f, 0.0f, 0.0f, progress * 0.9f );
|
||||||
|
for( float i = 0.0f; i <= M_PI * 2.01f; i += a )
|
||||||
x = screenGeom.x() + screenGeom.width() / 2;
|
glVertex3f( cenX + r * cos( i ), cenY + r * sin( i ), 0.0f );
|
||||||
y = screenGeom.y() + screenGeom.height() / 2;
|
|
||||||
glVertex3f( x, y, 0 );
|
|
||||||
|
|
||||||
glColor4f( 0.0f, 0.0f, 0.0f, progress * 0.9f );
|
|
||||||
|
|
||||||
x = ro * cos( i ) + screenGeom.x() + screenGeom.width() / 2;
|
|
||||||
y = ro * sin( i ) + screenGeom.y() + screenGeom.height() / 2;
|
|
||||||
glVertex3f( x, y, 0 );
|
|
||||||
|
|
||||||
x = ro * cos( i + a ) + screenGeom.x() + screenGeom.width() / 2;
|
|
||||||
y = ro * sin( i + a ) + screenGeom.y() + screenGeom.height() / 2;
|
|
||||||
glVertex3f( x, y, 0 );
|
|
||||||
}
|
|
||||||
glEnd();
|
glEnd();
|
||||||
glDisable( GL_SCISSOR_TEST );
|
glDisable( GL_SCISSOR_TEST );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue