aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2013-11-26 14:59:19 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-27 14:19:13 +0100
commit7811c22f8a18d14b33c04ca00e6b2b6ea5aef8df (patch)
tree09d2ec006e38767ca155aa36696328af52bc824b /src/quick
parent3c9c35b648e32082b30786fe71d4db33ffe2b5a6 (diff)
Delay renderWindow with a timer
Add an exhaust delay to QSGGuiThreadRenderLoop. Some updates may be done with posted events, and maybeUpdate event competed with those, leading to partial updates and frames drawn twice. Change-Id: I532bff692c597eeba5bbd6def89ae68c80fdd69b Done-with: Mikko Harju <mikko.harju@jollamobile.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index aa0d7b5a6c..52df55fa92 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -122,6 +122,7 @@ public:
QSGRenderContext *rc;
QImage grabContent;
+ int m_update_timer;
bool eventPending;
};
@@ -384,7 +385,8 @@ void QSGGuiThreadRenderLoop::maybeUpdate(QQuickWindow *window)
m_windows[window].updatePending = true;
if (!eventPending) {
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
+ const int exhaust_delay = 5;
+ m_update_timer = startTimer(exhaust_delay, Qt::PreciseTimer);
eventPending = true;
}
}
@@ -399,8 +401,10 @@ QSGContext *QSGGuiThreadRenderLoop::sceneGraphContext() const
bool QSGGuiThreadRenderLoop::event(QEvent *e)
{
- if (e->type() == QEvent::User) {
+ if (e->type() == QEvent::Timer) {
eventPending = false;
+ killTimer(m_update_timer);
+ m_update_timer = 0;
for (QHash<QQuickWindow *, WindowData>::const_iterator it = m_windows.constBegin();
it != m_windows.constEnd(); ++it) {
const WindowData &data = it.value();