diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-09-24 12:51:36 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-26 20:08:19 +0200 |
commit | 0150202cc710e580695656fee049bf25091c0ded (patch) | |
tree | 217f5fbf792b5d40baeea0916064bb0ac2050b84 /src/quick/scenegraph/qsgthreadedrenderloop.cpp | |
parent | c40d9f64a6bd9671edc807bc74cf5b73c7465250 (diff) |
Allow animators to work properly with multiple windows
Change-Id: I5ba663ba0fa089ea786cf43cb4dfa40cbc955342
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 88bc013306..a2c16fa4dd 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -281,6 +281,7 @@ public: : wm(w) , gl(0) , sg(QSGContext::createDefaultContext()) + , animatorDriver(0) , pendingUpdate(0) , sleeping(false) , syncResultedInChanges(false) @@ -330,6 +331,8 @@ public: QOpenGLContext *gl; QSGContext *sg; + QAnimationDriver *animatorDriver; + uint pendingUpdate; uint sleeping; uint syncResultedInChanges; @@ -375,6 +378,7 @@ bool QSGRenderThread::event(QEvent *e) window.window = se->window; window.size = se->size; m_windows << window; + connect(animatorDriver, SIGNAL(started()), QQuickWindowPrivate::get(se->window)->animationController, SLOT(animationsStarted())); return true; } case WM_Obscure: { @@ -384,6 +388,7 @@ bool QSGRenderThread::event(QEvent *e) if (m_windows.at(i).window == ce->window) { RLDEBUG1(" Render: - removed one..."); m_windows.removeAt(i); + disconnect(animatorDriver, SIGNAL(started()), QQuickWindowPrivate::get(ce->window)->animationController, SLOT(animationsStarted())); break; } } @@ -584,6 +589,9 @@ void QSGRenderThread::syncAndRender() #endif RLDEBUG(" Render: - rendering starting"); + if (animatorDriver->isRunning()) + animatorDriver->advance(); + for (int i=0; i<m_windows.size(); ++i) { Window &w = const_cast<Window &>(m_windows.at(i)); QQuickWindowPrivate *d = QQuickWindowPrivate::get(w.window); @@ -656,6 +664,10 @@ void QSGRenderThread::processEventsAndWaitForMore() void QSGRenderThread::run() { RLDEBUG1(" Render: run()"); + animatorDriver = sg->createAnimationDriver(0); + animatorDriver->install(); + QUnifiedTimer::instance(true)->setConsistentTiming(QSGRenderLoop::useConsistentTiming()); + while (!shouldExit) { if (m_windows.size() > 0) { @@ -682,6 +694,9 @@ void QSGRenderThread::run() Q_ASSERT_X(!gl, "QSGRenderThread::run()", "The OpenGL context should be cleaned up before exiting the render thread..."); RLDEBUG1(" Render: run() completed..."); + + delete animatorDriver; + animatorDriver = 0; } QSGThreadedRenderLoop::QSGThreadedRenderLoop() |