From 77d5b1475aa6129d2f8a63e3e9b65d04075ace45 Mon Sep 17 00:00:00 2001 From: ExMix Date: Sun, 29 Nov 2015 15:15:10 +0300 Subject: [PATCH] [drape] send on reread only tiles that neighbour of outdated tiles --- drape_frontend/read_manager.cpp | 12 +++++++++++- drape_frontend/tile_utils.cpp | 6 ++++++ drape_frontend/tile_utils.hpp | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drape_frontend/read_manager.cpp b/drape_frontend/read_manager.cpp index 39f91ff588..c68407978e 100755 --- a/drape_frontend/read_manager.cpp +++ b/drape_frontend/read_manager.cpp @@ -106,7 +106,17 @@ void ReadManager::UpdateCoverage(ScreenBase const & screen, TTilesCollection con IncreaseCounter(static_cast(inputRects.size() + (m_tileInfos.size() - outdatedTiles.size()))); for_each(outdatedTiles.begin(), outdatedTiles.end(), bind(&ReadManager::ClearTileInfo, this, _1)); - for_each(m_tileInfos.begin(), m_tileInfos.end(), bind(&ReadManager::PushTaskFront, this, _1)); + for (shared_ptr const & tile : m_tileInfos) + { + for (shared_ptr & outTile : outdatedTiles) + { + if (IsNeighbours(tile->GetTileKey(), outTile->GetTileKey())) + { + PushTaskFront(tile); + break; + } + } + } for_each(inputRects.begin(), inputRects.end(), bind(&ReadManager::PushTaskBackForTileKey, this, _1, texMng)); } m_currentViewport = screen; diff --git a/drape_frontend/tile_utils.cpp b/drape_frontend/tile_utils.cpp index bc6f3ca67e..6407798c82 100755 --- a/drape_frontend/tile_utils.cpp +++ b/drape_frontend/tile_utils.cpp @@ -104,4 +104,10 @@ TileKey GetParentTile(TileKey const & tileKey, int targetZoom) targetZoom); } +bool IsNeighbours(TileKey const & tileKey1, TileKey const & tileKey2) +{ + return (abs(tileKey1.m_x - tileKey2.m_x) < 2) && + (abs(tileKey1.m_y - tileKey2.m_y) < 2); +} + } // namespace df diff --git a/drape_frontend/tile_utils.hpp b/drape_frontend/tile_utils.hpp index c7bb1669ac..3bf05cc571 100755 --- a/drape_frontend/tile_utils.hpp +++ b/drape_frontend/tile_utils.hpp @@ -28,4 +28,6 @@ bool IsTileBelow(TileKey const & tileKey, TileKey const & targetTileKey); /// This function returns parent tile on specified zoom level. TileKey GetParentTile(TileKey const & tileKey, int targetZoom); +bool IsNeighbours(TileKey const & tileKey1, TileKey const & tileKey2); + } // namespace df