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 ******************************************************************/
11 #include "demo_showpicture.h"
13 #include <kstandarddirs.h>
19 KWIN_EFFECT( demo_showpicture
, ShowPictureEffect
)
21 ShowPictureEffect::ShowPictureEffect()
27 ShowPictureEffect::~ShowPictureEffect()
32 void ShowPictureEffect::paintScreen( int mask
, QRegion region
, ScreenPaintData
& data
)
34 effects
->paintScreen( mask
, region
, data
);
40 if( picture
&& region
.intersects( pictureRect
))
42 glPushAttrib( GL_CURRENT_BIT
| GL_ENABLE_BIT
);
45 glBlendFunc( GL_SRC_ALPHA
, GL_ONE_MINUS_SRC_ALPHA
);
46 picture
->render( region
, pictureRect
);
52 void ShowPictureEffect::loadPicture()
54 QString file
= KGlobal::dirs()->findResource( "appdata", "showpicture.png" );
58 QRect area
= effects
->clientArea( PlacementArea
, effects
->activeScreen(), effects
->currentDesktop());
59 picture
= new GLTexture( im
);
60 pictureRect
= QRect( area
.x() + ( area
.width() - im
.width()) / 2,
61 area
.y() + ( area
.height() - im
.height()) / 2, im
.width(), im
.height());