Scale In plugin now uses TimeLine, also fade and scale in to
make it look slightly snazzier. svn path=/trunk/KDE/kdebase/workspace/; revision=803710
This commit is contained in:
parent
2826653703
commit
075dfd549f
2 changed files with 16 additions and 14 deletions
|
@ -27,32 +27,34 @@ KWIN_EFFECT( scalein, ScaleInEffect )
|
||||||
|
|
||||||
void ScaleInEffect::prePaintScreen( ScreenPrePaintData& data, int time )
|
void ScaleInEffect::prePaintScreen( ScreenPrePaintData& data, int time )
|
||||||
{
|
{
|
||||||
if( !windows.isEmpty())
|
if( !mTimeLineWindows.isEmpty() )
|
||||||
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
|
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
|
||||||
effects->prePaintScreen( data, time );
|
effects->prePaintScreen( data, time );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScaleInEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
void ScaleInEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
||||||
{
|
{
|
||||||
if( windows.contains( w ))
|
if( mTimeLineWindows.contains( w ) )
|
||||||
{
|
{
|
||||||
windows[ w ] += time / 300.; // complete change in 300ms
|
mTimeLineWindows[ w ].setCurveShape( TimeLine::EaseOutCurve );
|
||||||
if( windows[ w ] < 1 )
|
mTimeLineWindows[ w ].addTime( time );
|
||||||
|
if( mTimeLineWindows[ w ].value() < 1 )
|
||||||
data.setTransformed();
|
data.setTransformed();
|
||||||
else
|
else
|
||||||
windows.remove( w );
|
mTimeLineWindows.remove( w );
|
||||||
}
|
}
|
||||||
effects->prePaintWindow( w, data, time );
|
effects->prePaintWindow( w, data, time );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScaleInEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
void ScaleInEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
||||||
{
|
{
|
||||||
if( windows.contains( w ) && isScaleWindow( w ) )
|
if( mTimeLineWindows.contains( w ) && isScaleWindow( w ) )
|
||||||
{
|
{
|
||||||
data.xScale *= windows[ w ];
|
data.opacity *= 0.0 + ( 1 * mTimeLineWindows[ w ].value() );
|
||||||
data.yScale *= windows[ w ];
|
data.xScale *= mTimeLineWindows[ w ].value();
|
||||||
data.xTranslate += int( w->width() / 2 * ( 1 - windows[ w ] ));
|
data.yScale *= mTimeLineWindows[ w ].value();
|
||||||
data.yTranslate += int( w->height() / 2 * ( 1 - windows[ w ] ));
|
data.xTranslate += int( w->width() / 2 * ( 1 - mTimeLineWindows[ w ].value() ) );
|
||||||
|
data.yTranslate += int( w->height() / 2 * ( 1 - mTimeLineWindows[ w ].value() ) );
|
||||||
}
|
}
|
||||||
effects->paintWindow( w, mask, region, data );
|
effects->paintWindow( w, mask, region, data );
|
||||||
}
|
}
|
||||||
|
@ -67,7 +69,7 @@ bool ScaleInEffect::isScaleWindow( EffectWindow* w )
|
||||||
|
|
||||||
void ScaleInEffect::postPaintWindow( EffectWindow* w )
|
void ScaleInEffect::postPaintWindow( EffectWindow* w )
|
||||||
{
|
{
|
||||||
if( windows.contains( w ))
|
if( mTimeLineWindows.contains( w ) )
|
||||||
w->addRepaintFull(); // trigger next animation repaint
|
w->addRepaintFull(); // trigger next animation repaint
|
||||||
effects->postPaintWindow( w );
|
effects->postPaintWindow( w );
|
||||||
}
|
}
|
||||||
|
@ -76,14 +78,14 @@ void ScaleInEffect::windowAdded( EffectWindow* c )
|
||||||
{
|
{
|
||||||
if( c->isOnCurrentDesktop())
|
if( c->isOnCurrentDesktop())
|
||||||
{
|
{
|
||||||
windows[ c ] = 0;
|
mTimeLineWindows[ c ].setProgress( 0.0 );
|
||||||
c->addRepaintFull();
|
c->addRepaintFull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScaleInEffect::windowClosed( EffectWindow* c )
|
void ScaleInEffect::windowClosed( EffectWindow* c )
|
||||||
{
|
{
|
||||||
windows.remove( c );
|
mTimeLineWindows.remove( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ScaleInEffect
|
||||||
virtual void windowClosed( EffectWindow* c );
|
virtual void windowClosed( EffectWindow* c );
|
||||||
private:
|
private:
|
||||||
bool isScaleWindow ( EffectWindow* w );
|
bool isScaleWindow ( EffectWindow* w );
|
||||||
QHash< const EffectWindow*, double > windows;
|
QHash< const EffectWindow*, TimeLine > mTimeLineWindows;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in a new issue