diff options
Diffstat (limited to 'drape_frontend/frontend_renderer.cpp')
-rwxr-xr-x | drape_frontend/frontend_renderer.cpp | 91 |
1 files changed, 51 insertions, 40 deletions
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index dbf559fbb0..9754984a18 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -549,6 +549,12 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message) break; } + case Message::RecoverGLResources: + { + UpdateGLResources(); + break; + } + case Message::UpdateMapStyle: { // Clear all graphics. @@ -576,46 +582,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message) blocker.Wait(); } - // Invalidate route. - if (m_routeRenderer->GetStartPoint()) - { - m2::PointD const & position = m_routeRenderer->GetStartPoint()->m_position; - m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, - make_unique_dp<CacheRouteSignMessage>(position, true /* isStart */, - true /* isValid */), - MessagePriority::High); - } - if (m_routeRenderer->GetFinishPoint()) - { - m2::PointD const & position = m_routeRenderer->GetFinishPoint()->m_position; - m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, - make_unique_dp<CacheRouteSignMessage>(position, false /* isStart */, - true /* isValid */), - MessagePriority::High); - } - - auto const & routeData = m_routeRenderer->GetRouteData(); - if (routeData != nullptr) - { - auto recacheRouteMsg = make_unique_dp<AddRouteMessage>(routeData->m_sourcePolyline, - routeData->m_sourceTurns, - routeData->m_color, - routeData->m_pattern); - m_routeRenderer->Clear(true /* keepDistanceFromBegin */); - m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, move(recacheRouteMsg), - MessagePriority::Normal); - } - - // 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<UpdateReadManagerMessage>(), - MessagePriority::UberHighSingleton); - - m_gpsTrackRenderer->Update(); - + UpdateGLResources(); break; } @@ -753,6 +720,50 @@ unique_ptr<threads::IRoutine> FrontendRenderer::CreateRoutine() return make_unique<Routine>(*this); } +void FrontendRenderer::UpdateGLResources() +{ + // Invalidate route. + if (m_routeRenderer->GetStartPoint()) + { + m2::PointD const & position = m_routeRenderer->GetStartPoint()->m_position; + m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, + make_unique_dp<CacheRouteSignMessage>(position, true /* isStart */, + true /* isValid */), + MessagePriority::High); + } + + if (m_routeRenderer->GetFinishPoint()) + { + m2::PointD const & position = m_routeRenderer->GetFinishPoint()->m_position; + m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, + make_unique_dp<CacheRouteSignMessage>(position, false /* isStart */, + true /* isValid */), + MessagePriority::High); + } + + auto const & routeData = m_routeRenderer->GetRouteData(); + if (routeData != nullptr) + { + auto recacheRouteMsg = make_unique_dp<AddRouteMessage>(routeData->m_sourcePolyline, + routeData->m_sourceTurns, + routeData->m_color, + routeData->m_pattern); + m_routeRenderer->Clear(true /* keepDistanceFromBegin */); + m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, move(recacheRouteMsg), + MessagePriority::Normal); + } + + // 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<UpdateReadManagerMessage>(), + MessagePriority::UberHighSingleton); + + m_gpsTrackRenderer->Update(); +} + void FrontendRenderer::FollowRoute(int preferredZoomLevel, int preferredZoomLevelIn3d, bool enableAutoZoom) { |