aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-09-18 20:16:16 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-21 22:23:13 +0200
commita0f8be4021caa9bb5055923f0eea3bee0e345235 (patch)
treecf33dd92e8284f5692e65b1a574749d50da4a3f0 /src/quick/items
parent0fc040ef70513ccaeb9e96f7ca05a3df4d6c7879 (diff)
Animators - Render thread animation system
This introduces 6 new QML types for animating state in the scene graph when the UI thread is blocked. The QObject property being animated is updated after the animation completes. It works also with the "windows" and "basic" render loops, but offer litte benefit then compared to in the "threaded" case. Change-Id: Ic19e47c898c0b8bd53e457db922b3c9c457c8147 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickwindow.cpp10
-rw-r--r--src/quick/items/qquickwindow_p.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 5b4145e235..923b7605e1 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -53,6 +53,7 @@
#include <QtQuick/private/qsgflashnode_p.h>
#include <private/qsgrenderloop_p.h>
+#include <private/qquickanimatorcontroller_p.h>
#include <private/qguiapplication_p.h>
#include <QtGui/QInputMethod>
@@ -319,6 +320,8 @@ void QQuickWindowPrivate::syncSceneGraph()
QML_MEMORY_SCOPE_STRING("SceneGraph");
Q_Q(QQuickWindow);
+ animationController->beforeNodeSync();
+
emit q->beforeSynchronizing();
if (!renderer) {
forceUpdate(contentItem);
@@ -331,6 +334,8 @@ void QQuickWindowPrivate::syncSceneGraph()
updateDirtyNodes();
+ animationController->afterNodeSync();
+
// Copy the current state of clearing from window into renderer.
renderer->setClearColor(clearColor);
QSGRenderer::ClearMode mode = QSGRenderer::ClearStencilBuffer | QSGRenderer::ClearDepthBuffer;
@@ -344,6 +349,7 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size)
{
QML_MEMORY_SCOPE_STRING("SceneGraph");
Q_Q(QQuickWindow);
+ animationController->advance();
emit q->beforeRendering();
int fboId = 0;
const qreal devicePixelRatio = q->devicePixelRatio();
@@ -414,6 +420,9 @@ void QQuickWindowPrivate::init(QQuickWindow *c)
q->setSurfaceType(QWindow::OpenGLSurface);
q->setFormat(context->defaultSurfaceFormat());
+ animationController = new QQuickAnimatorController();
+ animationController->window = q;
+
QObject::connect(context, SIGNAL(initialized()), q, SIGNAL(sceneGraphInitialized()), Qt::DirectConnection);
QObject::connect(context, SIGNAL(invalidated()), q, SIGNAL(sceneGraphInvalidated()), Qt::DirectConnection);
QObject::connect(context, SIGNAL(invalidated()), q, SLOT(cleanupSceneGraph()), Qt::DirectConnection);
@@ -990,6 +999,7 @@ QQuickWindow::~QQuickWindow()
{
Q_D(QQuickWindow);
+ d->animationController->deleteLater();
d->windowManager->windowDestroyed(this);
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index e29ceb521f..c656eacce7 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -71,6 +71,7 @@ QT_BEGIN_NAMESPACE
//Make it easy to identify and customize the root item if needed
+class QQuickAnimatorController;
class QSGRenderLoop;
class QQuickDragGrabber;
@@ -197,6 +198,7 @@ public:
QSGRenderer *renderer;
QSGRenderLoop *windowManager;
+ QQuickAnimatorController *animationController;
QColor clearColor;