From 906d5c5c40183468f9521277c6244a6c46730de6 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 17 Oct 2013 14:53:33 +0200 Subject: 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 --- src/quick/items/qquickimage.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/quick/items/qquickimage.cpp') diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index d6be13f3c0..0708304051 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -532,17 +532,17 @@ QRectF QQuickImage::boundingRect() const QSGTextureProvider *QQuickImage::textureProvider() const { Q_D(const QQuickImage); + + if (!d->window || !d->sceneGraphRenderContext() || QThread::currentThread() != d->sceneGraphRenderContext()->thread()) { + qWarning("QQuickImage::textureProvider: can only be queried on the rendering thread of an exposed window"); + return 0; + } + if (!d->provider) { - // Make sure it gets thread affinity on the rendering thread so deletion works properly.. - Q_ASSERT_X(d->window - && d->sceneGraphContext() - && QThread::currentThread() == d->sceneGraphContext()->thread(), - "QQuickImage::textureProvider", - "Cannot be used outside the GUI thread"); QQuickImagePrivate *dd = const_cast(d); dd->provider = new QQuickImageTextureProvider; dd->provider->m_smooth = d->smooth; - dd->provider->m_texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), window()); + dd->provider->m_texture = d->sceneGraphRenderContext()->textureForFactory(d->pix.textureFactory(), window()); } return d->provider; @@ -552,7 +552,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { Q_D(QQuickImage); - QSGTexture *texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), window()); + QSGTexture *texture = d->sceneGraphRenderContext()->textureForFactory(d->pix.textureFactory(), window()); // Copy over the current texture state into the texture provider... if (d->provider) { -- cgit v1.2.3