Adding test if cylinder and sphere effects are supported by the hardware, so that they can't be activated if not supported.

svn path=/trunk/KDE/kdebase/workspace/; revision=848633
icc-effect-5.14.5
Martin Gräßlin 2008-08-18 09:52:33 +00:00
parent d5be0f8da5
commit 3341354228
4 changed files with 20 additions and 0 deletions

View File

@ -31,6 +31,7 @@ namespace KWin
{ {
KWIN_EFFECT( cylinder, CylinderEffect ) KWIN_EFFECT( cylinder, CylinderEffect )
KWIN_EFFECT_SUPPORTED( cylinder, CylinderEffect::supported() )
CylinderEffect::CylinderEffect() CylinderEffect::CylinderEffect()
: CubeEffect() : CubeEffect()
@ -49,6 +50,13 @@ CylinderEffect::~CylinderEffect()
delete mShader; delete mShader;
} }
bool CylinderEffect::supported()
{
return GLRenderTarget::supported() &&
GLShader::fragmentShaderSupported() &&
(effects->compositingType() == OpenGLCompositing);
}
bool CylinderEffect::loadData() bool CylinderEffect::loadData()
{ {
mInited = true; mInited = true;

View File

@ -36,6 +36,8 @@ class CylinderEffect
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ); virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ); virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
virtual void desktopChanged( int old ); virtual void desktopChanged( int old );
static bool supported();
protected: protected:
virtual void paintScene( int mask, QRegion region, ScreenPaintData& data ); virtual void paintScene( int mask, QRegion region, ScreenPaintData& data );
virtual void paintCap( float z, float zTexture ); virtual void paintCap( float z, float zTexture );

View File

@ -31,6 +31,7 @@ namespace KWin
{ {
KWIN_EFFECT( sphere, SphereEffect ) KWIN_EFFECT( sphere, SphereEffect )
KWIN_EFFECT_SUPPORTED( sphere, SphereEffect::supported() )
SphereEffect::SphereEffect() SphereEffect::SphereEffect()
: CubeEffect() : CubeEffect()
@ -50,6 +51,13 @@ SphereEffect::~SphereEffect()
delete mShader; delete mShader;
} }
bool SphereEffect::supported()
{
return GLRenderTarget::supported() &&
GLShader::fragmentShaderSupported() &&
(effects->compositingType() == OpenGLCompositing);
}
bool SphereEffect::loadData() bool SphereEffect::loadData()
{ {
mInited = true; mInited = true;

View File

@ -35,6 +35,8 @@ class SphereEffect
~SphereEffect(); ~SphereEffect();
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ); virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ); virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
static bool supported();
protected: protected:
virtual void paintScene( int mask, QRegion region, ScreenPaintData& data ); virtual void paintScene( int mask, QRegion region, ScreenPaintData& data );
virtual void paintCap( float z, float zTexture ); virtual void paintCap( float z, float zTexture );