aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-06-12 16:30:05 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-13 10:00:56 +0200
commite500396d12c9f0155797ff53e347bf8ba9f69c7a (patch)
tree48d02db4241f5834562f990ec4744296df22bfaa /src
parentd1b549956423867054732e233b05a61501c44360 (diff)
Fix resizing canvas with renderStrategy == Cooperative
updatePolish() called prepare() which would use a queued metaInvoke() to change the size of the texture. However, there is no guaranteed event processing on the render thread between polish on the GUI thread and sync on the render thread, we would very often get to updatePaintNode() before the queued invoke landed, resulting the drawing being done to a texture of the wrong size. Fix this by calling prepare from updatePaintNode when in CooperativeMode so that the autoconnection becomes a direct one and we get prepare and flush processed in the right order. Change-Id: I0fa4687a94ada4bdaddca19133e686bca0bc745c Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 4144256a38..3b1b6d5086 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -645,7 +645,7 @@ void QQuickCanvasItem::updatePolish()
Q_D(QQuickCanvasItem);
- if (d->context)
+ if (d->context && d->renderStrategy != QQuickCanvasItem::Cooperative)
d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, d->antialiasing);
if (d->animationCallbacks.size() > 0 && isVisible()) {
@@ -697,8 +697,10 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
else
node->setFiltering(QSGTexture::Nearest);
- if (d->renderStrategy == QQuickCanvasItem::Cooperative)
+ if (d->renderStrategy == QQuickCanvasItem::Cooperative) {
+ d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, d->antialiasing);
d->context->flush();
+ }
node->setTexture(d->context->texture());
node->markDirty(QSGNode::DirtyMaterial);