From 493dea89672a8b4e4e1e3149283e93c0bfbe261c Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 28 May 2013 09:42:05 +0200 Subject: Do not draw negative-size ShaderEffect(Source) items. We were a bit inconsistent here. A negative size Image element would not render at all, a negative size ShaderEffect would render mirrored and a negative size ShaderEffectSource would trigger an assert. Be consistent and not draw any of them. DropShadow from QtGraphicalEffects uses both a ShaderEffectSource and a ShaderEffect together, so keeping the behavior in ShaderEffect would make it render incorrectly. Task-number: QTBUG-31383 Change-Id: Ied5568d7edbc2aed96b00adfdc6aae09b6f2a7d9 Reviewed-by: Mitch Curtis --- src/quick/items/qquickshadereffect.cpp | 4 ++-- src/quick/items/qquickshadereffectsource.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 102066704b..f39a15070c 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -912,8 +912,8 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa { QQuickShaderEffectNode *node = static_cast(oldNode); - // In the case of a bad vertex shader, don't try to create a node... - if (m_common.attributes.isEmpty()) { + // In the case of zero-size or a bad vertex shader, don't try to create a node... + if (m_common.attributes.isEmpty() || width() <= 0 || height() <= 0) { if (node) delete node; return 0; diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp index bd0bb2348e..9debfe35b3 100644 --- a/src/quick/items/qquickshadereffectsource.cpp +++ b/src/quick/items/qquickshadereffectsource.cpp @@ -942,7 +942,7 @@ void QQuickShaderEffectSource::releaseResources() QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { - if (!m_sourceItem || m_sourceItem->width() == 0 || m_sourceItem->height() == 0) { + if (!m_sourceItem || m_sourceItem->width() <= 0 || m_sourceItem->height() <= 0) { if (m_texture) m_texture->setItem(0); delete oldNode; -- cgit v1.2.3