Round values, don't just truncate.

svn path=/branches/work/kwin_composite/; revision=656976
This commit is contained in:
Luboš Luňák 2007-04-22 21:22:05 +00:00
parent 98a7c3da6a
commit 56e5618f0e

View file

@ -10,6 +10,8 @@ License. See the file "COPYING" for the exact licensing terms.
#include "desktopgrid.h" #include "desktopgrid.h"
#include <math.h>
#include <kaction.h> #include <kaction.h>
#include <kactioncollection.h> #include <kactioncollection.h>
#include <klocale.h> #include <klocale.h>
@ -276,10 +278,10 @@ QRect DesktopGridEffect::desktopRect( int desktop, bool scaled ) const
if( !scaled ) if( !scaled )
return rect; return rect;
QRect current = desktopRect( effects->currentDesktop(), false ); QRect current = desktopRect( effects->currentDesktop(), false );
rect = QRect( int( interpolate( rect.x() - current.x(), rect.x() / float( x ), progress )), rect = QRect( lround( interpolate( rect.x() - current.x(), rect.x() / float( x ), progress )),
int( interpolate( rect.y() - current.y(), rect.y() / float( y ), progress )), lround( interpolate( rect.y() - current.y(), rect.y() / float( y ), progress )),
int( interpolate( rect.width(), displayWidth() / float( x ), progress )), lround( interpolate( rect.width(), displayWidth() / float( x ), progress )),
int( interpolate( rect.height(), displayHeight() / float( y ), progress ))); lround( interpolate( rect.height(), displayHeight() / float( y ), progress )));
return rect; return rect;
} }