1
/********************************************************************
2
KWin - the KDE window manager
3
This file is part of the KDE project.
5
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*********************************************************************/
21
#ifndef KWIN_SCENE_XRENDER_H
22
#define KWIN_SCENE_XRENDER_H
24
#include <config-workspace.h>
29
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
30
#include <X11/extensions/Xrender.h>
31
#include <X11/extensions/Xfixes.h>
42
SceneXrender(Workspace* ws);
43
virtual ~SceneXrender();
44
virtual bool initFailed() const;
45
virtual CompositingType compositingType() const {
46
return XRenderCompositing;
48
virtual void paint(QRegion damage, ToplevelList windows);
49
virtual void windowGeometryShapeChanged(Toplevel*);
50
virtual void windowOpacityChanged(Toplevel*);
51
virtual void windowAdded(Toplevel*);
52
virtual void windowClosed(Toplevel*, Deleted*);
53
virtual void windowDeleted(Deleted*);
54
Picture bufferPicture();
56
virtual void paintBackground(QRegion region);
57
virtual void paintGenericScreen(int mask, ScreenPaintData data);
59
void paintTransformedScreen(int mask);
61
void flushBuffer(int mask, QRegion damage);
63
void selfCheckSetup();
64
bool selfCheckFinish();
65
XRenderPictFormat* format;
67
static Picture buffer;
68
static ScreenPaintData screen_paint;
70
QHash< Toplevel*, Window* > windows;
74
class SceneXrender::Window
75
: public Scene::Window
80
virtual void performPaint(int mask, QRegion region, WindowPaintData data);
81
void discardPicture();
83
QRegion transformedShape() const;
84
void setTransformedShape(const QRegion& shape);
87
Picture alphaMask(double opacity);
88
QRect mapToScreen(int mask, const WindowPaintData &data, const QRect &rect) const;
89
QPoint mapToScreen(int mask, const WindowPaintData &data, const QPoint &point) const;
90
void prepareTempPixmap(const QPixmap *left, const QPixmap *top, const QPixmap *right, const QPixmap *bottom);
92
XRenderPictFormat* format;
94
double alpha_cached_opacity;
95
QRegion transformed_shape;
96
static QPixmap *temp_pixmap;
99
class SceneXrender::EffectFrame
100
: public Scene::EffectFrame
103
EffectFrame(EffectFrameImpl* frame);
104
virtual ~EffectFrame();
107
virtual void freeIconFrame();
108
virtual void freeTextFrame();
109
virtual void freeSelection();
110
virtual void crossFadeIcon();
111
virtual void crossFadeText();
112
virtual void render(QRegion region, double opacity, double frameOpacity);
115
void updatePicture();
116
void updateTextPicture();
118
XRenderPicture* m_picture;
119
XRenderPicture* m_textPicture;
120
XRenderPicture* m_iconPicture;
121
XRenderPicture* m_selectionPicture;
125
Picture SceneXrender::bufferPicture()
131
QRegion SceneXrender::Window::transformedShape() const
133
return transformed_shape;
137
void SceneXrender::Window::setTransformedShape(const QRegion& shape)
139
transformed_shape = shape;
143
* @short XRender implementation of Shadow.
145
* This class extends Shadow by the elements required for XRender rendering.
146
* @author Jacopo De Simoi <wilderkde@gmail.org>
149
class SceneXRenderShadow
153
SceneXRenderShadow(Toplevel *toplevel);
154
virtual ~SceneXRenderShadow();
156
Qt::HANDLE x11ShadowPictureHandle(WindowQuadType);
157
void layoutShadowRects(QRect& top, QRect& topRight,
158
QRect& right, QRect& bottomRight,
159
QRect& bottom, QRect& bottomLeft,
160
QRect& Left, QRect& topLeft);
162
const QPixmap &resizedShadowPixmap(ShadowElements element) const {
163
return m_resizedElements[element];
167
virtual void buildQuads();
170
QPixmap m_resizedElements[ShadowElementsCount];