From: Gunnar Sletta Date: Thu, 12 May 2011 10:54:54 +0000 (+0200) Subject: When calling update() on a QSGItem during the sync phase, we did not update. X-Git-Tag: qt-v5.0.0-alpha1~2170^2~117 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=733bacbcf92e402688e9d4b2ab23fab19c13f715;p=profile%2Fivi%2Fqtdeclarative.git When calling update() on a QSGItem during the sync phase, we did not update. The QSGCanvas autotest did this. Reviewed-by: Kim --- diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp index 895cc16..6214da6 100644 --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@ -299,7 +299,9 @@ void QSGCanvasPrivate::polishItems() void QSGCanvasPrivate::syncSceneGraph() { + inSync = true; updateDirtyNodes(); + inSync = false; } @@ -452,6 +454,7 @@ QSGCanvasPrivate::QSGCanvasPrivate() , idle(false) , needsRepaint(true) , renderThreadAwakened(false) + , inSync(false) , thread(new MyThread(this)) , animationDriver(0) { @@ -1851,6 +1854,12 @@ void QSGCanvas::maybeUpdate() qWarning("QSGRenderer: now maybe I should update..."); #endif d->wait.wakeOne(); + } else if (d->inSync) { + // If we are in sync (on scene graph thread) someone has explicitely asked us + // to redraw, hence we tell the render loop to not go idle. + // The primary usecase for this is updatePaintNode() calling update() without + // changing the scene graph. + d->needsRepaint = true; } if (locked) d->mutex.unlock(); diff --git a/src/declarative/items/qsgcanvas_p.h b/src/declarative/items/qsgcanvas_p.h index 98c3d93..6b8034f 100644 --- a/src/declarative/items/qsgcanvas_p.h +++ b/src/declarative/items/qsgcanvas_p.h @@ -163,6 +163,7 @@ public: uint idle : 1; // Set to true when render thread sees no change and enters a wait() uint needsRepaint : 1; // Set by callback from render if scene needs repainting. uint renderThreadAwakened : 1; + uint inSync: 1; struct MyThread : public QThread { MyThread(QSGCanvasPrivate *r) : renderer(r) {}