2006-07-05 12:30:03 +00:00
|
|
|
/*****************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
|
|
|
You can Freely distribute this program under the GNU General Public
|
|
|
|
License. See the file "COPYING" for the exact licensing terms.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
#ifndef KWIN_SCENE_XRENDER_H
|
|
|
|
#define KWIN_SCENE_XRENDER_H
|
|
|
|
|
2006-07-05 13:26:08 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2006-10-16 21:06:34 +00:00
|
|
|
#include "scene.h"
|
|
|
|
|
2006-07-05 13:26:08 +00:00
|
|
|
#ifdef HAVE_XRENDER
|
|
|
|
#include <X11/extensions/Xrender.h>
|
|
|
|
|
2006-07-05 12:30:03 +00:00
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
2006-07-06 09:55:10 +00:00
|
|
|
class Matrix;
|
|
|
|
|
2006-07-05 13:26:08 +00:00
|
|
|
class SceneXrender
|
|
|
|
: public Scene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SceneXrender( Workspace* ws );
|
|
|
|
virtual ~SceneXrender();
|
2006-09-30 15:40:03 +00:00
|
|
|
virtual void paint( QRegion damage, ToplevelList windows );
|
2006-07-05 20:52:57 +00:00
|
|
|
virtual void windowGeometryShapeChanged( Toplevel* );
|
|
|
|
virtual void windowOpacityChanged( Toplevel* );
|
2006-09-29 19:05:36 +00:00
|
|
|
virtual void windowAdded( Toplevel* );
|
2006-07-05 20:52:57 +00:00
|
|
|
virtual void windowDeleted( Toplevel* );
|
2006-11-19 20:25:04 +00:00
|
|
|
Picture bufferPicture();
|
2006-10-16 21:06:34 +00:00
|
|
|
protected:
|
|
|
|
virtual void paintBackground( QRegion region );
|
2006-10-21 18:07:00 +00:00
|
|
|
virtual void paintGenericScreen( int mask, ScreenPaintData data );
|
2006-07-05 13:26:08 +00:00
|
|
|
private:
|
2006-12-04 18:30:41 +00:00
|
|
|
void paintTransformedScreen( int mask );
|
2006-07-05 13:26:08 +00:00
|
|
|
void createBuffer();
|
2006-10-15 07:41:19 +00:00
|
|
|
static XserverRegion toXserverRegion( QRegion region );
|
2006-07-05 13:26:08 +00:00
|
|
|
XRenderPictFormat* format;
|
|
|
|
Picture front;
|
2006-10-14 22:08:51 +00:00
|
|
|
static Picture buffer;
|
2006-10-21 18:07:00 +00:00
|
|
|
static ScreenPaintData screen_paint;
|
2006-10-16 21:06:34 +00:00
|
|
|
class Window;
|
2006-10-14 22:08:51 +00:00
|
|
|
QMap< Toplevel*, Window > windows;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SceneXrender::Window
|
2006-10-15 08:58:38 +00:00
|
|
|
: public Scene::Window
|
2006-10-14 22:08:51 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Window( Toplevel* c );
|
2006-10-16 21:06:34 +00:00
|
|
|
virtual void free();
|
2006-10-22 10:15:19 +00:00
|
|
|
virtual void performPaint( int mask, QRegion region, WindowPaintData data );
|
2006-10-14 22:08:51 +00:00
|
|
|
void discardPicture();
|
|
|
|
void discardAlpha();
|
2006-12-04 18:30:41 +00:00
|
|
|
QRegion transformedShape() const;
|
|
|
|
void setTransformedShape( const QRegion& shape );
|
2006-10-14 22:08:51 +00:00
|
|
|
Window() {} // QMap sucks even in Qt4
|
|
|
|
private:
|
|
|
|
Picture picture();
|
2006-10-22 10:15:19 +00:00
|
|
|
Picture alphaMask( double opacity );
|
2006-10-14 22:08:51 +00:00
|
|
|
Picture _picture;
|
|
|
|
XRenderPictFormat* format;
|
|
|
|
Picture alpha;
|
|
|
|
double alpha_cached_opacity;
|
2006-12-04 18:30:41 +00:00
|
|
|
QRegion transformed_shape;
|
2006-07-05 13:26:08 +00:00
|
|
|
};
|
|
|
|
|
2006-11-19 20:25:04 +00:00
|
|
|
inline
|
|
|
|
Picture SceneXrender::bufferPicture()
|
|
|
|
{
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2006-12-04 18:30:41 +00:00
|
|
|
inline
|
|
|
|
QRegion SceneXrender::Window::transformedShape() const
|
|
|
|
{
|
|
|
|
return transformed_shape;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
void SceneXrender::Window::setTransformedShape( const QRegion& shape )
|
|
|
|
{
|
|
|
|
transformed_shape = shape;
|
|
|
|
}
|
|
|
|
|
2006-07-05 12:30:03 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|
2006-07-05 13:26:08 +00:00
|
|
|
|
|
|
|
#endif
|