2007-04-29 17:35:43 +00:00
|
|
|
/*****************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
|
|
|
You can Freely distribute this program under the GNU General Public
|
|
|
|
License. See the file "COPYING" for the exact licensing terms.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
#include "scalein.h"
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2007-05-28 11:16:18 +00:00
|
|
|
KWIN_EFFECT( scalein, ScaleInEffect )
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-07-07 14:01:32 +00:00
|
|
|
void ScaleInEffect::prePaintScreen( ScreenPrePaintData& data, int time )
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
if( !windows.isEmpty())
|
2007-07-07 14:01:32 +00:00
|
|
|
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
|
|
|
|
effects->prePaintScreen( data, time );
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2007-07-07 14:01:32 +00:00
|
|
|
void ScaleInEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
if( windows.contains( w ))
|
|
|
|
{
|
2007-11-03 18:01:46 +00:00
|
|
|
windows[ w ] += time / 300.; // complete change in 300ms
|
2007-04-29 17:35:43 +00:00
|
|
|
if( windows[ w ] < 1 )
|
2007-07-19 14:05:59 +00:00
|
|
|
data.setTransformed();
|
2007-04-29 17:35:43 +00:00
|
|
|
else
|
|
|
|
windows.remove( w );
|
|
|
|
}
|
2007-07-07 14:01:32 +00:00
|
|
|
effects->prePaintWindow( w, data, time );
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleInEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
|
|
|
{
|
|
|
|
if( windows.contains( w ))
|
|
|
|
{
|
|
|
|
data.xScale *= windows[ w ];
|
|
|
|
data.yScale *= windows[ w ];
|
|
|
|
data.xTranslate += int( w->width() / 2 * ( 1 - windows[ w ] ));
|
|
|
|
data.yTranslate += int( w->height() / 2 * ( 1 - windows[ w ] ));
|
|
|
|
}
|
|
|
|
effects->paintWindow( w, mask, region, data );
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleInEffect::postPaintWindow( EffectWindow* w )
|
|
|
|
{
|
|
|
|
if( windows.contains( w ))
|
|
|
|
w->addRepaintFull(); // trigger next animation repaint
|
|
|
|
effects->postPaintWindow( w );
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleInEffect::windowAdded( EffectWindow* c )
|
|
|
|
{
|
|
|
|
if( c->isOnCurrentDesktop())
|
|
|
|
{
|
|
|
|
windows[ c ] = 0;
|
|
|
|
c->addRepaintFull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleInEffect::windowClosed( EffectWindow* c )
|
|
|
|
{
|
|
|
|
windows.remove( c );
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|