diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-10-17 14:53:33 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-30 08:29:49 +0100 |
commit | 906d5c5c40183468f9521277c6244a6c46730de6 (patch) | |
tree | 0eb46a8f88d59993ab659e2dc07970d1ce2f0d73 /src/quick/items/qquickwindow.cpp | |
parent | c084d32d92b2df55532fa1599e590c29bf2b5bfb (diff) |
Use one render loop per QQuickWindow
See the task for the full reasoning behind this patch.
The threaded renderloop has been refactored to have one window per
thread. This is mostly a simplification of the current code path where
for loops over multiple windows are turned into if (window).
The QSGContext has been split into two classes, QSGRenderContext
for which there is one per OpenGLContext.
The rest of the patch is name changes and a couple of cleanups
in the hopes of simplifying this change.
Task-number: QTBUG-33993
Change-Id: I31c81f9694d7da7474a72333169be38de62613c4
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index fd0313aed5..ed97325c85 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -50,8 +50,6 @@ #include <QtQuick/private/qsgrenderer_p.h> #include <QtQuick/private/qsgtexture_p.h> -#include <QtQuick/private/qsgflashnode_p.h> - #include <private/qsgrenderloop_p.h> #include <private/qquickanimatorcontroller_p.h> @@ -416,9 +414,10 @@ void QQuickWindowPrivate::init(QQuickWindow *c) contentItemPrivate->flags |= QQuickItem::ItemIsFocusScope; windowManager = QSGRenderLoop::instance(); - context = windowManager->sceneGraphContext(); + QSGContext *sg = windowManager->sceneGraphContext(); + context = windowManager->createRenderContext(sg); q->setSurfaceType(QWindow::OpenGLSurface); - q->setFormat(context->defaultSurfaceFormat()); + q->setFormat(sg->defaultSurfaceFormat()); animationController = new QQuickAnimatorController(); animationController->window = q; @@ -2319,10 +2318,6 @@ void QQuickWindowPrivate::updateDirtyNodes() void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) { -#ifdef QML_RUNTIME_TESTING - bool didFlash = false; -#endif - QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item); quint32 dirty = itemPriv->dirtyAttributes; itemPriv->dirtyAttributes = 0; @@ -2546,19 +2541,6 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) } #endif -#ifdef QML_RUNTIME_TESTING - if (itemPriv->sceneGraphContext()->isFlashModeEnabled()) { - QSGFlashNode *flash = new QSGFlashNode(); - flash->setRect(item->boundingRect()); - itemPriv->childContainerNode()->appendChildNode(flash); - didFlash = true; - } - Q_Q(QQuickWindow); - if (didFlash) { - q->maybeUpdate(); - } -#endif - } void QQuickWindow::maybeUpdate() @@ -2598,9 +2580,7 @@ void QQuickWindow::setTransientParent_helper(QQuickWindow *window) QOpenGLContext *QQuickWindow::openglContext() const { Q_D(const QQuickWindow); - if (d->context->isReady()) - return d->context->glContext(); - return 0; + return d->context->openglContext(); } /*! @@ -2796,7 +2776,7 @@ QImage QQuickWindow::grabWindow() Q_D(QQuickWindow); if (!isVisible()) { - if (d->context->isReady()) { + if (d->context->openglContext()) { qWarning("QQuickWindow::grabWindow: scene graph already in use"); return QImage(); } @@ -2993,7 +2973,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateTextureOptions options) const { Q_D(const QQuickWindow); - if (d->context && d->context->isReady()) { + if (d->context && d->context->openglContext()) { if (options & TextureCanUseAtlas) return d->context->createTexture(image); else @@ -3021,7 +3001,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateText QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const { Q_D(const QQuickWindow); - if (d->context && d->context->isReady()) { + if (d->context && d->context->openglContext()) { QSGPlainTexture *texture = new QSGPlainTexture(); texture->setTextureId(id); texture->setHasAlphaChannel(options & TextureHasAlphaChannel); |