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>
6 Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.com>
7 Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************/
26 #include <kwineffects.h>
27 #include <kwinxrenderutils.h>
35 : public QObject
, public Effect
40 virtual ~ShadowEffect();
41 virtual void reconfigure( ReconfigureFlags
);
42 virtual void prePaintWindow( EffectWindow
* w
, WindowPrePaintData
& data
, int time
);
43 virtual void drawWindow( EffectWindow
* w
, int mask
, QRegion region
, WindowPaintData
& data
);
44 virtual void paintScreen( int mask
, QRegion region
, ScreenPaintData
& data
);
45 virtual void windowClosed( EffectWindow
* c
);
46 virtual void buildQuads( EffectWindow
* w
, WindowQuadList
& quadList
);
47 virtual QRect
transformWindowDamage( EffectWindow
* w
, const QRect
& r
);
50 void updateShadowColor();
53 void prepareRenderStates( GLTexture
*texture
, double opacity
, double brightness
, double saturation
);
54 void restoreRenderStates( GLTexture
*texture
, double opacity
, double brightness
, double saturation
);
56 void drawShadowQuadOpenGL( GLTexture
*texture
, QVector
<float> verts
, QVector
<float> texCoords
,
57 QColor color
, QRegion region
, float opacity
, float brightness
, float saturation
);
58 void drawShadowQuadXRender( XRenderPicture
*picture
, QRect rect
, float xScale
, float yScale
,
59 QColor color
, float opacity
, float brightness
, float saturation
);
61 void drawShadow( EffectWindow
* w
, int mask
, QRegion region
, const WindowPaintData
& data
);
62 void addQuadVertices(QVector
<float>& verts
, float x1
, float y1
, float x2
, float y2
) const;
63 // transforms window rect -> shadow rect
64 QRect
shadowRectangle( EffectWindow
* w
, const QRect
& windowRectangle
) const;
65 bool useShadow( EffectWindow
* w
) const;
66 void drawQueuedShadows( EffectWindow
* behindWindow
);
68 int shadowXOffset
, shadowYOffset
;
72 bool intensifyActiveShadow
;
75 bool forceUndecorated
;
77 #ifdef KWIN_HAVE_OPENGL_COMPOSITING
78 QList
< QList
<GLTexture
*> > mShadowTextures
;
79 QList
<GLTexture
*> mDefaultShadowTextures
;
81 #ifdef KWIN_HAVE_XRENDER_COMPOSITING
82 QList
< QList
<XRenderPicture
*> > mShadowPics
;
83 QList
<XRenderPicture
*> mDefaultShadowPics
;
86 QList
<WindowQuadType
> mShadowQuadTypes
;
87 WindowQuadType mDefaultShadowQuadType
;
91 ShadowData(EffectWindow
* _w
, WindowPaintData
& _data
) : w(_w
), data(_data
) {}
99 QList
<ShadowData
> shadowDatas
;