1 /*****************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org>
7 You can Freely distribute this program under the GNU General Public
8 License. See the file "COPYING" for the exact licensing terms.
9 ******************************************************************/
19 KWIN_EFFECT( flame
, FlameEffect
)
21 void FlameEffect::prePaintScreen( ScreenPrePaintData
& data
, int time
)
23 if( !windows
.isEmpty())
24 data
.mask
|= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS
;
25 effects
->prePaintScreen(data
, time
);
28 void FlameEffect::prePaintWindow( EffectWindow
* w
, WindowPrePaintData
& data
, int time
)
30 if( windows
.contains( w
))
32 if( windows
[ w
] < 1 )
34 windows
[ w
] += time
/ 500.;
35 data
.setTransformed();
36 w
->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE
);
37 data
.quads
= data
.quads
.splitAtY( windows
[ w
] * w
->height());
45 effects
->prePaintWindow( w
, data
, time
);
48 void FlameEffect::paintWindow( EffectWindow
* w
, int mask
, QRegion region
, WindowPaintData
& data
)
50 if( windows
.contains( w
))
52 WindowQuadList new_quads
;
53 double ylimit
= windows
[ w
] * w
->height(); // parts above this are already away
54 foreach( const WindowQuad
&quad
, data
.quads
)
56 if( quad
.bottom() <= ylimit
)
58 new_quads
.append( quad
);
60 if( new_quads
.isEmpty())
61 return; // nothing to paint
62 data
.quads
= new_quads
;
64 effects
->paintWindow( w
, mask
, region
, data
);
67 void FlameEffect::postPaintWindow( EffectWindow
* w
)
69 if( windows
.contains( w
))
70 effects
->addRepaint( w
->geometry()); // workspace, since the window under it will need painting too
71 effects
->postPaintScreen();
74 void FlameEffect::windowClosed( EffectWindow
* c
)
80 void FlameEffect::windowDeleted( EffectWindow
* c
)