- Check if the FBO size will exceed GL_MAX_TEXTURE_SIZE in

BlurEffect::supported().
- Don't announce support to clients if the shader failed to compile,
  or the FBO is invalid.

svn path=/trunk/KDE/kdebase/workspace/; revision=1179268
This commit is contained in:
Fredrik Höglund 2010-09-25 00:11:06 +00:00
parent c87be852e0
commit 6d398323eb

View file

@ -44,12 +44,16 @@ BlurEffect::BlurEffect()
net_wm_blur_region = XInternAtom(display(), "_KDE_NET_WM_BLUR_BEHIND_REGION", False);
effects->registerPropertyType(net_wm_blur_region, true);
reconfigure(ReconfigureAll);
// ### Hackish way to announce support.
// Should be included in _NET_SUPPORTED instead.
if (shader->isValid() && target->valid()) {
XChangeProperty(display(), rootWindow(), net_wm_blur_region, net_wm_blur_region,
32, PropModeReplace, 0, 0);
reconfigure(ReconfigureAll);
} else {
XDeleteProperty(display(), rootWindow(), net_wm_blur_region);
}
}
BlurEffect::~BlurEffect()
@ -69,6 +73,9 @@ void BlurEffect::reconfigure(ReconfigureFlags flags)
KConfigGroup cg = EffectsHandler::effectConfig("Blur");
int radius = qBound(2, cg.readEntry("BlurRadius", 12), 14);
shader->setRadius(radius);
if (!shader->isValid())
XDeleteProperty(display(), rootWindow(), net_wm_blur_region);
}
void BlurEffect::updateBlurRegion(EffectWindow *w) const
@ -111,6 +118,15 @@ bool BlurEffect::supported()
{
bool supported = GLRenderTarget::supported() && GLTexture::NPOTTextureSupported() &&
(GLSLBlurShader::supported() || ARBBlurShader::supported());
if (supported) {
int maxTexSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
if (displayWidth() > maxTexSize || displayHeight() > maxTexSize)
supported = false;
}
if (supported) {
// check the blacklist
KSharedConfigPtr config = KSharedConfig::openConfig( "kwinrc" );