From: Taylor Braun-Jones Date: Fri, 1 Aug 2014 14:48:37 +0000 (-0400) Subject: Fix FBO recreated every time the QSG node is updated under some conditions X-Git-Tag: v5.3.99+beta1~80^2^2~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89a01dcbc2d427e661c19d50c5b875b1dc54b2f9;p=platform%2Fupstream%2Fqtdeclarative.git Fix FBO recreated every time the QSG node is updated under some conditions When textureFollowsItemsSize is true and the item width/height are (1) not precise integer values or (2) less than the minimum FBO width/height, then QQuickFramebufferObject will delete and recreate the FBO every time the QSG node is updated. This patch fixes the issue. Task-number: QTBUG-40548 Change-Id: I532aaaa88a5c604ee7cc1fd8f0acb0601c5a94fb Reviewed-by: Gunnar Sletta --- diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 10d281b..4c43292 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -235,8 +235,12 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode n->renderer->synchronize(this); + QSize minFboSize = d->sceneGraphContext()->minimumFBOSize(); + QSize desiredFboSize(qMax(minFboSize.width(), width()), + qMax(minFboSize.height(), height())); + if (n->fbo && (d->followsItemSize || n->invalidatePending)) { - if (n->fbo->width() != width() || n->fbo->height() != height()) { + if (n->fbo->size() != desiredFboSize) { delete n->fbo; n->fbo = 0; delete n->msDisplayFbo; @@ -245,10 +249,7 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode } if (!n->fbo) { - QSize minFboSize = d->sceneGraphContext()->minimumFBOSize(); - QSize fboSize(qMax(minFboSize.width(), width()), - qMax(minFboSize.height(), height())); - n->fbo = n->renderer->createFramebufferObject(fboSize); + n->fbo = n->renderer->createFramebufferObject(desiredFboSize); GLuint displayTexture = n->fbo->texture();