summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Dabrowski <[email protected]>2015-04-14 09:48:44 +0200
committerTorsten Rahn <[email protected]>2015-04-14 09:48:44 +0200
commit7c4dcf9e0b384301df29fc062ef29c031eae45d3 (patch)
treeb645193e741af5b5f7b25c0ae4913f4e7352cb61
parent4c37550eccb539c49ec05302cf793fa996eca85c (diff)
Fixes a tile scaling bug that resulted in low level tiles creating a
peculiar mosaic on intensive zooming to non-predownloaded areas. (YAY!) REVIEW: 123306
-rw-r--r--src/lib/marble/TileLoader.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/marble/TileLoader.cpp b/src/lib/marble/TileLoader.cpp
index 01994eb..2fe67c2 100644
--- a/src/lib/marble/TileLoader.cpp
+++ b/src/lib/marble/TileLoader.cpp
@@ -78,6 +78,7 @@ QImage TileLoader::loadTileImage( GeoSceneTextureTile const *textureLayer, TileI
// tile was not locally available => trigger download and look for tiles in other levels
// for scaling
+
QImage replacementTile = scaledLowerLevelTile( textureLayer, tileId );
Q_ASSERT( !replacementTile.isNull() );
@@ -242,6 +243,7 @@ QImage TileLoader::scaledLowerLevelTile( const GeoSceneTextureTile * textureLaye
for ( int level = qMax<int>( 0, id.zoomLevel() - 1 ); level >= 0; --level ) {
int const deltaLevel = id.zoomLevel() - level;
+
TileId const replacementTileId( id.mapThemeIdHash(), level,
id.x() >> deltaLevel, id.y() >> deltaLevel );
QString const fileName = tileFileName( textureLayer, replacementTileId );
@@ -260,8 +262,8 @@ QImage TileLoader::scaledLowerLevelTile( const GeoSceneTextureTile * textureLaye
// which rect to scale?
int const restTileX = id.x() % ( 1 << deltaLevel );
int const restTileY = id.y() % ( 1 << deltaLevel );
- int const partWidth = toScale.width() >> deltaLevel;
- int const partHeight = toScale.height() >> deltaLevel;
+ int const partWidth = qMax(1, toScale.width() >> deltaLevel);
+ int const partHeight = qMax(1, toScale.height() >> deltaLevel);
int const startX = restTileX * partWidth;
int const startY = restTileY * partHeight;
mDebug() << "QImage::copy:" << startX << startY << partWidth << partHeight;