[effects] Simplify supported check in blur and backgroundcontrast

GLSL is always required nowadays on GL compositor.

REVIEW: 118642
This commit is contained in:
Martin Gräßlin 2014-06-10 17:09:20 +02:00
parent 490e733590
commit 8919cd5f54
6 changed files with 4 additions and 41 deletions

View file

@ -174,7 +174,7 @@ bool ContrastEffect::enabledByDefault()
bool ContrastEffect::supported()
{
bool supported = effects->isOpenGLCompositing() && GLRenderTarget::supported() && GLTexture::NPOTTextureSupported() && ContrastShader::supported();
bool supported = effects->isOpenGLCompositing() && GLRenderTarget::supported() && GLTexture::NPOTTextureSupported();
if (supported) {
int maxTexSize;

View file

@ -45,11 +45,7 @@ ContrastShader::~ContrastShader()
ContrastShader *ContrastShader::create()
{
if (ContrastShader::supported()) {
return new ContrastShader();
}
return NULL;
return new ContrastShader();
}
void ContrastShader::reset()
@ -60,19 +56,6 @@ void ContrastShader::reset()
setIsValid(false);
}
bool ContrastShader::supported()
{
if (!GLPlatform::instance()->supports(GLSL))
return false;
(void) glGetError(); // Clear the error state
if (glGetError() != GL_NO_ERROR)
return false;
return true;
}
void ContrastShader::setOpacity(float opacity)
{
m_opacity = opacity;

View file

@ -50,8 +50,6 @@ public:
void bind();
void unbind();
static bool supported();
void setOpacity(float opacity);
float opacity() const;

View file

@ -154,7 +154,7 @@ bool BlurEffect::enabledByDefault()
bool BlurEffect::supported()
{
bool supported = effects->isOpenGLCompositing() && GLRenderTarget::supported() && GLTexture::NPOTTextureSupported() && GLSLBlurShader::supported();
bool supported = effects->isOpenGLCompositing() && GLRenderTarget::supported() && GLTexture::NPOTTextureSupported();
if (supported) {
int maxTexSize;

View file

@ -43,10 +43,7 @@ BlurShader::~BlurShader()
BlurShader *BlurShader::create()
{
if (GLSLBlurShader::supported())
return new GLSLBlurShader();
return nullptr;
return new GLSLBlurShader();
}
void BlurShader::setRadius(int radius)
@ -131,19 +128,6 @@ void GLSLBlurShader::reset()
setIsValid(false);
}
bool GLSLBlurShader::supported()
{
if (!GLPlatform::instance()->supports(GLSL))
return false;
(void) glGetError(); // Clear the error state
if (glGetError() != GL_NO_ERROR)
return false;
return true;
}
void GLSLBlurShader::setPixelDistance(float val)
{
if (!isValid())

View file

@ -102,8 +102,6 @@ public:
void setTextureMatrix(const QMatrix4x4 &matrix);
void setModelViewProjectionMatrix(const QMatrix4x4 &matrix);
static bool supported();
protected:
void init();
void reset();