[drape] resolve resize problem on application start

This commit is contained in:
ExMix 2015-06-13 09:42:49 +03:00 committed by r.kuznetsov
parent b7ca2b9103
commit 5ea887f74d
2 changed files with 12 additions and 5 deletions

View file

@ -83,6 +83,8 @@ DrapeEngine::DrapeEngine(Params && params)
drape_ptr<GuiRecacheMessage> message( new GuiRecacheMessage(blocker, move(params.m_info), m_widgetSizes));
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread, move(message), MessagePriority::High);
blocker.Wait();
ResizeImpl(m_viewport.GetWidth(), m_viewport.GetHeight());
}
DrapeEngine::~DrapeEngine()
@ -99,11 +101,7 @@ DrapeEngine::~DrapeEngine()
void DrapeEngine::Resize(int w, int h)
{
if (m_viewport.GetHeight() != h || m_viewport.GetWidth() != w)
{
gui::DrapeGui::Instance().SetSurfaceSize(m2::PointF(w, h));
m_viewport.SetViewport(0, 0, w, h);
AddUserEvent(ResizeEvent(w, h));
}
ResizeImpl(w, h);
}
void DrapeEngine::AddTouchEvent(TouchEvent const & event)
@ -217,6 +215,13 @@ void DrapeEngine::UserPositionChanged(m2::PointD const & position)
});
}
void DrapeEngine::ResizeImpl(int w, int h)
{
gui::DrapeGui::Instance().SetSurfaceSize(m2::PointF(w, h));
m_viewport.SetViewport(0, 0, w, h);
AddUserEvent(ResizeEvent(w, h));
}
void DrapeEngine::SetCountryInfo(gui::CountryInfo const & info, bool isCurrentCountry, bool isCountryLoaded)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,

View file

@ -113,6 +113,8 @@ private:
void TapEvent(m2::PointD const & pxPoint, bool isLong, bool isMyPosition, FeatureID const & feature);
void UserPositionChanged(m2::PointD const & position);
void ResizeImpl(int w, int h);
private:
drape_ptr<FrontendRenderer> m_frontend;
drape_ptr<BackendRenderer> m_backend;