From 52c8bfa6be4fc6c47f99c9f37c142554932c7228 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Mon, 15 Aug 2016 12:12:25 +0200 Subject: Add OSM plugin parameter osm.mapping.highdpi_tiles This patch adds a mean to enable/disable high dpi support for the OSM plugin too, following the same approach taken for the mapbox and here plugins. In order to do so, it has been necessary to rework QGeoTileProviderOsm. It can now be constructed with an arbitrary number of TileProviders, as opposed to the previous approach with one primary and one fallback tileprovider. It has also been necessary to disable Nearest interpolation for high dpi tiles, as it appears to produce considerable artifacts. So in presence of highdpi tiles, Linear interpolation is now always used. Change-Id: Id7d20fd5a320f3d5ef41b9fa28447a5c4f5398be Reviewed-by: Alex Blasche --- src/location/maps/qgeotiledmapscene.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/location/maps/qgeotiledmapscene.cpp') diff --git a/src/location/maps/qgeotiledmapscene.cpp b/src/location/maps/qgeotiledmapscene.cpp index 33c0bb8c..3896a51e 100644 --- a/src/location/maps/qgeotiledmapscene.cpp +++ b/src/location/maps/qgeotiledmapscene.cpp @@ -661,9 +661,12 @@ void QGeoTiledMapRootNode::updateTiles(QGeoTiledMapTileContainerNode *root, delete node; } else { if (isTextureLinear != d->m_linearScaling) { - node->setFiltering(d->m_linearScaling ? QSGTexture::Linear : QSGTexture::Nearest); - if (node->texture()->textureSize().width() > d->m_tileSize) + if (node->texture()->textureSize().width() > d->m_tileSize) { + node->setFiltering(QSGTexture::Linear); // With mipmapping QSGTexture::Nearest generates artifacts node->setMipmapFiltering(QSGTexture::Linear); + } else { + node->setFiltering(d->m_linearScaling ? QSGTexture::Linear : QSGTexture::Nearest); + } dirtyBits |= QSGNode::DirtyMaterial; } if (dirtyBits != 0) @@ -680,9 +683,12 @@ 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())) { - tileNode->setFiltering(d->m_linearScaling ? QSGTexture::Linear : QSGTexture::Nearest); - if (tileNode->texture()->textureSize().width() > d->m_tileSize) + if (tileNode->texture()->textureSize().width() > d->m_tileSize) { + tileNode->setFiltering(QSGTexture::Linear); // with mipmapping QSGTexture::Nearest generates artifacts tileNode->setMipmapFiltering(QSGTexture::Linear); + } else { + tileNode->setFiltering(d->m_linearScaling ? QSGTexture::Linear : QSGTexture::Nearest); + } root->addChild(s, tileNode); } else { delete tileNode; -- cgit v1.2.1