Always emit signal after ShaderEffectSource::scheduleUpdate().
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>
Fri, 18 May 2012 12:23:29 +0000 (14:23 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 21 May 2012 09:22:43 +0000 (11:22 +0200)
The scheduledUpdateCompleted signal was originally added so that
you can take some action after updating a ShaderEffectSource with
scheduleUpdate(). However, before this commit, the signal would
not be emitted if the ShaderEffectSource was already up-to-date.
Instead, the signal would be delayed until the next time the
ShaderEffectSource was redrawn. This commit ensures the signal is
emitted even if the ShaderEffectSource is already up-to-date.

Change-Id: Idd22cdea1f7c14ed7a45081c98b8cfbef896dccd
Reviewed-by: Kim Gronholm <kim.1.gronholm@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/quick/items/qquickshadereffectsource.cpp

index a855c6d..4513263 100644 (file)
@@ -186,12 +186,13 @@ void QQuickShaderEffectTexture::bind()
 
 bool QQuickShaderEffectTexture::updateTexture()
 {
-    if ((m_live || m_grab) && m_dirtyTexture) {
+    bool doGrab = (m_live || m_grab) && m_dirtyTexture;
+    if (doGrab)
         grab();
-        m_grab = false;
-        return true;
-    }
-    return false;
+    if (m_grab)
+        emit scheduledUpdateCompleted();
+    m_grab = false;
+    return doGrab;
 }
 
 void QQuickShaderEffectTexture::setHasMipmaps(bool mipmap)
@@ -297,8 +298,6 @@ void QQuickShaderEffectTexture::grab()
         m_fbo = m_secondaryFbo = 0;
         m_depthStencilBuffer.clear();
         m_dirtyTexture = false;
-        if (m_grab)
-            emit scheduledUpdateCompleted();
         return;
     }
     QSGNode *root = m_item;
@@ -443,9 +442,6 @@ void QQuickShaderEffectTexture::grab()
 #endif
     if (m_recursive)
         markDirtyTexture(); // Continuously update if 'live' and 'recursive'.
-
-    if (m_grab)
-        emit scheduledUpdateCompleted();
 }
 
 QImage QQuickShaderEffectTexture::toImage() const