diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2019-05-14 16:39:11 +0300 |
---|---|---|
committer | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2019-05-17 18:45:59 +0300 |
commit | a3007501b4c097ae916932ee1b019a456695a48e (patch) | |
tree | 1b86c1912778b102d4fb1ab3022fdb128b90a5c9 /map | |
parent | 4695b23cdbfd0fbae4b1d3f47bd4d3ff1ac390d1 (diff) |
[drape] Fixed rendering initialization notification
Diffstat (limited to 'map')
-rw-r--r-- | map/framework.cpp | 17 | ||||
-rw-r--r-- | map/framework.hpp | 4 |
2 files changed, 20 insertions, 1 deletions
diff --git a/map/framework.cpp b/map/framework.cpp index b9acb9de17..af74fca2cb 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1890,6 +1890,15 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::GraphicsContextFactory> contextFac m_localAdsManager.GetStatistics().RegisterEvents(std::move(statEvents)); }; + auto onGraphicsContextInitialized = [this]() + { + GetPlatform().RunTask(Platform::Thread::Gui, [this]() + { + if (m_onGraphicsContextInitialized) + m_onGraphicsContextInitialized(); + }); + }; + auto isUGCFn = [this](FeatureID const & id) { auto const ugc = m_ugcApi->GetLoader().GetUGC(id); @@ -1917,7 +1926,8 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::GraphicsContextFactory> contextFac move(myPositionModeChangedFn), allow3dBuildings, trafficEnabled, params.m_isChoosePositionMode, params.m_isChoosePositionMode, GetSelectedFeatureTriangles(), m_routingManager.IsRoutingActive() && m_routingManager.IsRoutingFollowing(), - isAutozoomEnabled, simplifiedTrafficColors, move(overlaysShowStatsFn), move(isUGCFn)); + isAutozoomEnabled, simplifiedTrafficColors, move(overlaysShowStatsFn), move(isUGCFn), + move(onGraphicsContextInitialized)); m_drapeEngine = make_unique_dp<df::DrapeEngine>(move(p)); m_drapeEngine->SetModelViewListener([this](ScreenBase const & screen) @@ -2030,6 +2040,11 @@ void Framework::SetRenderingDisabled(bool destroySurface) m_drapeEngine->SetRenderingDisabled(destroySurface); } +void Framework::SetGraphicsContextInitializationHandler(df::OnGraphicsContextInitialized && handler) +{ + m_onGraphicsContextInitialized = std::move(handler); +} + void Framework::EnableDebugRectRendering(bool enabled) { if (m_drapeEngine) diff --git a/map/framework.hpp b/map/framework.hpp index 5830ef68a5..d4a135a53d 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -516,6 +516,8 @@ public: void SetRenderingEnabled(ref_ptr<dp::GraphicsContextFactory> contextFactory = nullptr); void SetRenderingDisabled(bool destroySurface); + void SetGraphicsContextInitializationHandler(df::OnGraphicsContextInitialized && handler); + void OnRecoverSurface(int width, int height, bool recreateContextDependentResources); void OnDestroySurface(); @@ -525,6 +527,8 @@ private: /// Depends on initialized Drape engine. void LoadViewport(); + df::OnGraphicsContextInitialized m_onGraphicsContextInitialized; + public: void ConnectToGpsTracker(); void DisconnectFromGpsTracker(); |