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_SUPPORTED( cylinder, CylinderEffect::supported() )
CylinderEffect::CylinderEffect()
: CubeEffect()
@ -49,6 +50,13 @@ CylinderEffect::~CylinderEffect()
delete mShader;
}
bool CylinderEffect::supported()
{
return GLRenderTarget::supported() &&
GLShader::fragmentShaderSupported() &&
(effects->compositingType() == OpenGLCompositing);
}
bool CylinderEffect::loadData()
{
mInited = true;

View File

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

View File

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

View File

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