aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickshadereffectsource.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@sletta.org>2014-10-01 11:12:18 +0200
committerGunnar Sletta <gunnar@sletta.org>2014-10-01 12:19:14 +0200
commit64e2fa80015fb7d9e53cc66357870d4ea11f3590 (patch)
tree15a72f25a368c8eb8d4f94b4eadda6b83b33cce3 /src/quick/items/qquickshadereffectsource.cpp
parent125c96476e98cb393d2cf133a8245cb0672109a1 (diff)
Partially revert d9c531781e6c95f80681b3c82700833e1de88794
This logic changed then timing for when the layer's m_dirtyTexture was set and unset, which had some side effects. Revert to the old and known-to-work behavior of using a connection. Change-Id: I4048e7ae70491afe36b2d766e6c506d9febc44ed Task-number: QTBUG-41451 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/quick/items/qquickshadereffectsource.cpp')
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index 120a8956eb..520a58a37b 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -74,7 +74,6 @@ public:
QSGTexture::WrapMode horizontalWrap;
QSGTexture::WrapMode verticalWrap;
};
-#include "qquickshadereffectsource.moc"
class QQuickShaderEffectSourceCleanup : public QRunnable
{
@@ -586,13 +585,24 @@ void QQuickShaderEffectSource::releaseResources()
}
}
+class QQuickShaderSourceAttachedNode : public QObject, public QSGNode
+{
+ Q_OBJECT
+public:
+ Q_SLOT void markTextureDirty() {
+ QSGNode *pn = QSGNode::parent();
+ if (pn) {
+ Q_ASSERT(pn->type() == QSGNode::GeometryNodeType);
+ pn->markDirty(DirtyMaterial);
+ }
+ }
+};
+
QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
if (!m_sourceItem || m_sourceItem->width() <= 0 || m_sourceItem->height() <= 0) {
- if (m_texture) {
+ if (m_texture)
m_texture->setItem(0);
- m_texture->setShaderSourceNode(0);
- }
delete oldNode;
return 0;
}
@@ -658,7 +668,9 @@ QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaint
node = d->sceneGraphContext()->createImageNode();
node->setFlag(QSGNode::UsePreprocess);
node->setTexture(m_texture);
- m_texture->setShaderSourceNode(node);
+ QQuickShaderSourceAttachedNode *attached = new QQuickShaderSourceAttachedNode;
+ node->appendChildNode(attached);
+ connect(m_texture, SIGNAL(updateRequested()), attached, SLOT(markTextureDirty()));
}
// If live and recursive, update continuously.
@@ -698,4 +710,6 @@ void QQuickShaderEffectSource::itemChange(ItemChange change, const ItemChangeDat
QQuickItem::itemChange(change, value);
}
+#include "qquickshadereffectsource.moc"
+
QT_END_NAMESPACE