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>
28 #ifdef KWIN_HAVE_XRENDER_COMPOSITING
29 #include <X11/extensions/Xrender.h>
30 #include <X11/extensions/Xfixes.h>
40 SceneXrender( Workspace
* ws
);
41 virtual ~SceneXrender();
42 virtual bool initFailed() const;
43 virtual CompositingType
compositingType() const { return XRenderCompositing
; }
44 virtual void paint( QRegion damage
, ToplevelList windows
);
45 virtual void windowGeometryShapeChanged( Toplevel
* );
46 virtual void windowOpacityChanged( Toplevel
* );
47 virtual void windowAdded( Toplevel
* );
48 virtual void windowClosed( Toplevel
*, Deleted
* );
49 virtual void windowDeleted( Deleted
* );
50 Picture
bufferPicture();
52 virtual void paintBackground( QRegion region
);
53 virtual void paintGenericScreen( int mask
, ScreenPaintData data
);
55 void paintTransformedScreen( int mask
);
57 XRenderPictFormat
* format
;
59 static Picture buffer
;
60 static ScreenPaintData screen_paint
;
62 QHash
< Toplevel
*, Window
* > windows
;
66 class SceneXrender::Window
67 : public Scene::Window
70 Window( Toplevel
* c
);
72 virtual void performPaint( int mask
, QRegion region
, WindowPaintData data
);
73 void discardPicture();
75 QRegion
transformedShape() const;
76 void setTransformedShape( const QRegion
& shape
);
79 Picture
alphaMask( double opacity
);
81 XRenderPictFormat
* format
;
83 double alpha_cached_opacity
;
84 QRegion transformed_shape
;
88 Picture
SceneXrender::bufferPicture()
94 QRegion
SceneXrender::Window::transformedShape() const
96 return transformed_shape
;
100 void SceneXrender::Window::setTransformedShape( const QRegion
& shape
)
102 transformed_shape
= shape
;