From 2521e5fe81a4b1f2d5b0819ef4c7f239c8fc55b9 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Mon, 16 Jan 2017 16:26:35 +0100 Subject: 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 --- src/location/maps/qgeotiledmapscene.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/location/maps') 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::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 { -- cgit v1.2.1