forked from organicmaps/organicmaps
Fixed crash in navigation on switch to night style.
This commit is contained in:
parent
530f7c2703
commit
aab9c22273
5 changed files with 20 additions and 37 deletions
|
@ -102,11 +102,6 @@ void DrapeEngine::Update(int w, int h)
|
|||
make_unique_dp<RecoverGLResourcesMessage>(),
|
||||
MessagePriority::High);
|
||||
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<GuiLayerLayoutMessage>(m_widgetsLayout),
|
||||
MessagePriority::Normal);
|
||||
|
||||
|
||||
ResizeImpl(w, h);
|
||||
}
|
||||
|
||||
|
@ -204,13 +199,7 @@ void DrapeEngine::UpdateMapStyle()
|
|||
}
|
||||
|
||||
// Recache gui after updating of style.
|
||||
{
|
||||
RecacheGui(false);
|
||||
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<GuiLayerLayoutMessage>(m_widgetsLayout),
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
RecacheGui(false);
|
||||
}
|
||||
|
||||
void DrapeEngine::RecacheMapShapes()
|
||||
|
@ -408,6 +397,12 @@ void DrapeEngine::SetRoutePoint(m2::PointD const & position, bool isStart, bool
|
|||
void DrapeEngine::SetWidgetLayout(gui::TWidgetsLayoutInfo && info)
|
||||
{
|
||||
m_widgetsLayout = move(info);
|
||||
for (auto const & layout : m_widgetsLayout)
|
||||
{
|
||||
auto const itInfo = m_widgetsInfo.find(layout.first);
|
||||
if (itInfo != m_widgetsInfo.end())
|
||||
itInfo->second.m_pixelPivot = layout.second;
|
||||
}
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<GuiLayerLayoutMessage>(m_widgetsLayout),
|
||||
MessagePriority::Normal);
|
||||
|
|
|
@ -748,7 +748,7 @@ void FrontendRenderer::UpdateGLResources()
|
|||
routeData->m_sourceTurns,
|
||||
routeData->m_color,
|
||||
routeData->m_pattern);
|
||||
m_routeRenderer->Clear(true /* keepDistanceFromBegin */);
|
||||
m_routeRenderer->ClearGLDependentResources();
|
||||
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, move(recacheRouteMsg),
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
|
|
|
@ -287,6 +287,7 @@ public:
|
|||
{}
|
||||
|
||||
Type GetType() const override { return Message::GuiRecache;}
|
||||
bool IsGLContextDependent() const override { return true; }
|
||||
|
||||
gui::TWidgetsInitInfo const & GetInitInfo() const { return m_initInfo; }
|
||||
bool NeedResetOldGui() const { return m_needResetOldGui; }
|
||||
|
@ -302,6 +303,7 @@ public:
|
|||
MapShapesRecacheMessage() = default;
|
||||
|
||||
Type GetType() const override { return Message::MapShapesRecache; }
|
||||
bool IsGLContextDependent() const override { return true; }
|
||||
};
|
||||
|
||||
class GuiLayerLayoutMessage : public Message
|
||||
|
@ -312,6 +314,7 @@ public:
|
|||
{}
|
||||
|
||||
Type GetType() const override { return GuiLayerLayout; }
|
||||
bool IsGLContextDependent() const override { return true; }
|
||||
|
||||
gui::TWidgetsLayoutInfo const & GetLayoutInfo() const { return m_layoutInfo; }
|
||||
gui::TWidgetsLayoutInfo AcceptLayoutInfo() { return move(m_layoutInfo); }
|
||||
|
@ -735,6 +738,7 @@ public:
|
|||
RecoverGLResourcesMessage(){}
|
||||
|
||||
Type GetType() const override { return Message::RecoverGLResources; }
|
||||
bool IsGLContextDependent() const override { return true; }
|
||||
};
|
||||
|
||||
class DeactivateRouteFollowingMessage : public Message
|
||||
|
|
|
@ -229,7 +229,7 @@ void RouteRenderer::UpdateRoute(ScreenBase const & screen, TCacheRouteArrowsCall
|
|||
void RouteRenderer::RenderRoute(ScreenBase const & screen, ref_ptr<dp::GpuProgramManager> mng,
|
||||
dp::UniformValuesStorage const & commonUniforms)
|
||||
{
|
||||
if (!m_routeData || m_invalidGLResources)
|
||||
if (!m_routeData || m_routeData->m_route.m_buckets.empty())
|
||||
return;
|
||||
|
||||
// Render route.
|
||||
|
@ -284,9 +284,6 @@ void RouteRenderer::RenderRoute(ScreenBase const & screen, ref_ptr<dp::GpuProgra
|
|||
void RouteRenderer::RenderRouteSigns(ScreenBase const & screen, ref_ptr<dp::GpuProgramManager> mng,
|
||||
dp::UniformValuesStorage const & commonUniforms)
|
||||
{
|
||||
if (m_invalidGLResources)
|
||||
return;
|
||||
|
||||
if (m_startRouteSign)
|
||||
{
|
||||
ASSERT(m_startRouteSign->m_isValid, ());
|
||||
|
@ -304,7 +301,7 @@ void RouteRenderer::RenderRouteSign(drape_ptr<RouteSignData> const & sign, Scree
|
|||
ref_ptr<dp::GpuProgramManager> mng,
|
||||
dp::UniformValuesStorage const & commonUniforms)
|
||||
{
|
||||
if (m_invalidGLResources)
|
||||
if (sign->m_sign.m_buckets.empty())
|
||||
return;
|
||||
|
||||
dp::GLState const & state = sign->m_sign.m_state;
|
||||
|
@ -328,19 +325,14 @@ void RouteRenderer::RenderRouteSign(drape_ptr<RouteSignData> const & sign, Scree
|
|||
|
||||
void RouteRenderer::SetRouteData(drape_ptr<RouteData> && routeData, ref_ptr<dp::GpuProgramManager> mng)
|
||||
{
|
||||
m_invalidGLResources = false;
|
||||
|
||||
m_routeData = move(routeData);
|
||||
m_arrowBorders.clear();
|
||||
|
||||
BuildBuckets(m_routeData->m_route, mng);
|
||||
m_distanceFromBegin = 0.0;
|
||||
}
|
||||
|
||||
void RouteRenderer::SetRouteSign(drape_ptr<RouteSignData> && routeSignData, ref_ptr<dp::GpuProgramManager> mng)
|
||||
{
|
||||
m_invalidGLResources = false;
|
||||
|
||||
if (routeSignData->m_isStart)
|
||||
{
|
||||
if (!routeSignData->m_isValid)
|
||||
|
@ -383,34 +375,28 @@ drape_ptr<RouteData> const & RouteRenderer::GetRouteData() const
|
|||
void RouteRenderer::SetRouteArrows(drape_ptr<RouteArrowsData> && routeArrowsData,
|
||||
ref_ptr<dp::GpuProgramManager> mng)
|
||||
{
|
||||
m_invalidGLResources = false;
|
||||
|
||||
m_routeArrows = move(routeArrowsData);
|
||||
BuildBuckets(m_routeArrows->m_arrows, mng);
|
||||
}
|
||||
|
||||
void RouteRenderer::Clear(bool keepDistanceFromBegin)
|
||||
void RouteRenderer::Clear()
|
||||
{
|
||||
m_routeData.reset();
|
||||
m_startRouteSign.reset();
|
||||
m_finishRouteSign.reset();
|
||||
m_arrowBorders.clear();
|
||||
m_routeArrows.reset();
|
||||
|
||||
if (!keepDistanceFromBegin)
|
||||
m_distanceFromBegin = 0.0;
|
||||
m_distanceFromBegin = 0.0;
|
||||
}
|
||||
|
||||
void RouteRenderer::ClearGLDependentResources()
|
||||
{
|
||||
m_invalidGLResources = true;
|
||||
|
||||
if (m_routeData != nullptr)
|
||||
m_routeData->m_route.m_buckets.clear();
|
||||
m_routeData->m_route = RouteRenderProperty();
|
||||
if (m_startRouteSign != nullptr)
|
||||
m_startRouteSign->m_sign.m_buckets.clear();
|
||||
m_startRouteSign->m_sign = RouteRenderProperty();
|
||||
if (m_finishRouteSign != nullptr)
|
||||
m_finishRouteSign->m_sign.m_buckets.clear();
|
||||
m_finishRouteSign->m_sign = RouteRenderProperty();
|
||||
m_routeArrows.reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
void SetRouteArrows(drape_ptr<RouteArrowsData> && routeArrowsData, ref_ptr<dp::GpuProgramManager> mng);
|
||||
|
||||
void Clear(bool keepDistanceFromBegin = false);
|
||||
void Clear();
|
||||
void ClearGLDependentResources();
|
||||
|
||||
void UpdateDistanceFromBegin(double distanceFromBegin);
|
||||
|
@ -55,8 +55,6 @@ private:
|
|||
|
||||
float m_currentHalfWidth = 0.0f;
|
||||
float m_currentAlpha = 0.0f;
|
||||
|
||||
bool m_invalidGLResources = false;
|
||||
};
|
||||
|
||||
} // namespace df
|
||||
|
|
Loading…
Add table
Reference in a new issue