aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickimage.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-09-05 11:13:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-09 22:58:45 +0200
commit755b44a4cb90e146333f1898aec91f1912a08f59 (patch)
tree6d072c87c39caa69e63a9a660363f928e13bba9d /src/quick/items/qquickimage.cpp
parentded1bda38739512a9d4e0415eb5fa0c5e976de4d (diff)
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 <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/quick/items/qquickimage.cpp')
-rw-r--r--src/quick/items/qquickimage.cpp19
1 files changed, 11 insertions, 8 deletions
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);