diff --git a/drape_frontend/batchers_pool.hpp b/drape_frontend/batchers_pool.hpp index cda9f4ec86..85e2b7145a 100644 --- a/drape_frontend/batchers_pool.hpp +++ b/drape_frontend/batchers_pool.hpp @@ -29,7 +29,7 @@ public: private: typedef pair TBatcherPair; - typedef map TBatcherMap; + typedef map TBatcherMap; typedef TBatcherMap::iterator TIterator; TSendMessageFn m_sendMessageFn; diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index f9bd78c6fe..2f904b5978 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -598,6 +598,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) // Request new tiles. ScreenBase screen = m_userEventStream.GetCurrentScreen(); + m_lastReadedModelView = screen; m_requestedTiles->Set(screen, m_isIsometry || screen.isPerspective(), ResolveTileKeys(screen)); m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, make_unique_dp(), @@ -760,6 +761,7 @@ void FrontendRenderer::InvalidateRect(m2::RectD const & gRect) blocker.Wait(); // Request new tiles. + m_lastReadedModelView = screen; m_requestedTiles->Set(screen, m_isIsometry || screen.isPerspective(), ResolveTileKeys(screen)); m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, make_unique_dp(), @@ -1577,10 +1579,14 @@ void FrontendRenderer::UpdateScene(ScreenBase const & modelView) for (RenderLayer & layer : m_layers) layer.m_isDirty |= RemoveGroups(removePredicate, layer.m_renderGroups, make_ref(m_overlayTree)); - m_requestedTiles->Set(modelView, m_isIsometry || modelView.isPerspective(), ResolveTileKeys(modelView)); - m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, - make_unique_dp(), - MessagePriority::UberHighSingleton); + if (m_lastReadedModelView != modelView) + { + m_lastReadedModelView = modelView; + m_requestedTiles->Set(modelView, m_isIsometry || modelView.isPerspective(), ResolveTileKeys(modelView)); + m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, + make_unique_dp(), + MessagePriority::UberHighSingleton); + } } void FrontendRenderer::EmitModelViewChanged(ScreenBase const & modelView) const diff --git a/drape_frontend/frontend_renderer.hpp b/drape_frontend/frontend_renderer.hpp index 01862c80c1..15b845da7c 100755 --- a/drape_frontend/frontend_renderer.hpp +++ b/drape_frontend/frontend_renderer.hpp @@ -271,6 +271,7 @@ private: TTapEventInfoFn m_tapEventInfoFn; TUserPositionChangedFn m_userPositionChangedFn; + ScreenBase m_lastReadedModelView; TTilesCollection m_notFinishedTiles; int m_currentZoomLevel = -1; diff --git a/drape_frontend/read_manager.cpp b/drape_frontend/read_manager.cpp index a2d6d20eb5..e8a50861e6 100755 --- a/drape_frontend/read_manager.cpp +++ b/drape_frontend/read_manager.cpp @@ -40,7 +40,6 @@ ReadManager::ReadManager(ref_ptr commutator, MapDataProvider : m_commutator(commutator) , m_model(model) , m_pool(make_unique_dp(ReadCount(), bind(&ReadManager::OnTaskFinished, this, _1))) - , m_forceUpdate(true) , m_have3dBuildings(false) , m_allow3dBuildings(allow3dBuildings) , m_modeChanged(false) @@ -88,10 +87,6 @@ void ReadManager::OnTaskFinished(threads::IRoutine * task) void ReadManager::UpdateCoverage(ScreenBase const & screen, bool have3dBuildings, TTilesCollection const & tiles, ref_ptr texMng) { - if (screen == m_currentViewport && !m_forceUpdate) - return; - - m_forceUpdate = false; m_modeChanged |= (m_have3dBuildings != have3dBuildings); m_have3dBuildings = have3dBuildings; @@ -160,8 +155,6 @@ void ReadManager::Invalidate(TTilesCollection const & keyStorage) CancelTileInfo(info); m_tileInfos.erase(info); } - - m_forceUpdate = true; } void ReadManager::InvalidateAll() @@ -171,7 +164,6 @@ void ReadManager::InvalidateAll() m_tileInfos.clear(); - m_forceUpdate = true; m_modeChanged = true; } @@ -271,7 +263,6 @@ void ReadManager::Allow3dBuildings(bool allow3dBuildings) if (m_allow3dBuildings != allow3dBuildings) { m_modeChanged = true; - m_forceUpdate = true; m_allow3dBuildings = allow3dBuildings; } } diff --git a/drape_frontend/read_manager.hpp b/drape_frontend/read_manager.hpp index 36df8d6cd2..22eb7119da 100755 --- a/drape_frontend/read_manager.hpp +++ b/drape_frontend/read_manager.hpp @@ -54,7 +54,6 @@ private: drape_ptr m_pool; ScreenBase m_currentViewport; - bool m_forceUpdate; bool m_have3dBuildings; bool m_allow3dBuildings; bool m_modeChanged; diff --git a/drape_frontend/tile_key.hpp b/drape_frontend/tile_key.hpp index d277abbe22..b9a2de9395 100755 --- a/drape_frontend/tile_key.hpp +++ b/drape_frontend/tile_key.hpp @@ -31,6 +31,14 @@ struct TileKey uint64_t m_generation; }; +struct TileKeyStrictComparator +{ + bool operator() (TileKey const & lhs, TileKey const & rhs) const + { + return lhs.LessStrict(rhs); + } +}; + string DebugPrint(TileKey const & key); } // namespace df