From 755b44a4cb90e146333f1898aec91f1912a08f59 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 5 Sep 2013 11:13:08 +0200 Subject: Make tiled images not use atlas. The imagenode has two code paths, one fast path relying on GL_REPEAT and one slower based on one quad per internal tile. The quad path is very costly and should be avoided at all cost so extract the texture from the atlas when we have tiling. Task-number: QTBUG-33310 Task-number: QTBUG-29786 Change-Id: I952749e86dc407db43b168db3ab880eb93329a7a Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/quick/items/qquickimage.cpp | 19 +++++++++++-------- 1 file changed, 11 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 6fe4b39974..be3011b204 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -571,14 +571,6 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) node = d->sceneGraphContext()->createImageNode(); } - if (d->pixmapChanged) { - // force update the texture in the node to trigger reconstruction of - // geometry and the likes when a atlas segment has changed. - node->setTexture(0); - node->setTexture(texture); - d->pixmapChanged = false; - } - QRectF targetRect; QRectF sourceRect; QSGTexture::WrapMode hWrap = QSGTexture::ClampToEdge; @@ -671,6 +663,17 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) sourceRect.width() / d->pix.width(), sourceRect.height() / d->pix.height()); + if (d->pixmapChanged) { + // force update the texture in the node to trigger reconstruction of + // geometry and the likes when a atlas segment has changed. + node->setTexture(0); + if (texture->isAtlasTexture() && (hWrap == QSGTexture::Repeat || vWrap == QSGTexture::Repeat)) + node->setTexture(texture->removedFromAtlas()); + else + node->setTexture(texture); + d->pixmapChanged = false; + } + node->setHorizontalWrapMode(hWrap); node->setVerticalWrapMode(vWrap); node->setFiltering(d->smooth ? QSGTexture::Linear : QSGTexture::Nearest); -- cgit v1.2.3