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 void flushBuffer( int mask
, QRegion damage
);
59 XRenderPictFormat
* format
;
61 static Picture buffer
;
62 static ScreenPaintData screen_paint
;
64 QHash
< Toplevel
*, Window
* > windows
;
68 class SceneXrender::Window
69 : public Scene::Window
72 Window( Toplevel
* c
);
74 virtual void performPaint( int mask
, QRegion region
, WindowPaintData data
);
75 void discardPicture();
77 QRegion
transformedShape() const;
78 void setTransformedShape( const QRegion
& shape
);
81 Picture
alphaMask( double opacity
);
83 XRenderPictFormat
* format
;
85 double alpha_cached_opacity
;
86 QRegion transformed_shape
;
90 Picture
SceneXrender::bufferPicture()
96 QRegion
SceneXrender::Window::transformedShape() const
98 return transformed_shape
;
102 void SceneXrender::Window::setTransformedShape( const QRegion
& shape
)
104 transformed_shape
= shape
;