diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-01-16 16:26:35 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-02-28 10:27:22 +0000 |
commit | 2521e5fe81a4b1f2d5b0819ef4c7f239c8fc55b9 (patch) | |
tree | 516a5b18c233867ba831fd252f06a30ebc218f8f | |
parent | 0ac5180d59bcdf66d9c9f75432a36713beee308d (diff) | |
download | qtlocation-2521e5fe81a4b1f2d5b0819ef4c7f239c8fc55b9.tar.gz |
Consider devicePixelRatio when enabling tiles mipmapping
Tiles are magnified when high dpi scaling factor is used for the
app, so the scale factor must be considered when tile size is
used to decide whether to switch mipmapping on or not
Change-Id: I628ddc82f41bbdb94d0c1c6ed628bc13990f64bf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r-- | src/location/maps/qgeotiledmapscene.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/location/maps/qgeotiledmapscene.cpp b/src/location/maps/qgeotiledmapscene.cpp index d859c2af..6247f335 100644 --- a/src/location/maps/qgeotiledmapscene.cpp +++ b/src/location/maps/qgeotiledmapscene.cpp @@ -653,6 +653,7 @@ void QGeoTiledMapRootNode::updateTiles(QGeoTiledMapTileContainerNode *root, foreach (const QGeoTileSpec &s, toRemove) delete root->tiles.take(s); + qreal pixelRatio = window->effectiveDevicePixelRatio(); for (QHash<QGeoTileSpec, QSGImageNode *>::iterator it = root->tiles.begin(); it != root->tiles.end(); ) { QSGImageNode *node = it.value(); @@ -665,7 +666,7 @@ void QGeoTiledMapRootNode::updateTiles(QGeoTiledMapTileContainerNode *root, delete node; } else { if (isTextureLinear != d->m_linearScaling) { - if (node->texture()->textureSize().width() > d->m_tileSize) { + if (node->texture()->textureSize().width() > d->m_tileSize * pixelRatio) { node->setFiltering(QSGTexture::Linear); // With mipmapping QSGTexture::Nearest generates artifacts node->setMipmapFiltering(QSGTexture::Linear); } else { @@ -687,7 +688,7 @@ void QGeoTiledMapRootNode::updateTiles(QGeoTiledMapTileContainerNode *root, // note: setTexture will update coordinates so do it here, before we buildGeometry tileNode->setTexture(textures.value(s)); if (d->buildGeometry(s, tileNode) && qgeotiledmapscene_isTileInViewport(tileNode->rect(), root->matrix())) { - if (tileNode->texture()->textureSize().width() > d->m_tileSize) { + if (tileNode->texture()->textureSize().width() > d->m_tileSize * pixelRatio) { tileNode->setFiltering(QSGTexture::Linear); // with mipmapping QSGTexture::Nearest generates artifacts tileNode->setMipmapFiltering(QSGTexture::Linear); } else { |