forked from organicmaps/organicmaps
[ios] Added destroying GL context on entering background
This commit is contained in:
parent
2646590cf7
commit
4e08004dee
3 changed files with 25 additions and 1 deletions
|
@ -627,7 +627,17 @@ using namespace osm_auth_ios;
|
|||
LOG(LINFO, ("applicationWillResignActive"));
|
||||
[self.mapViewController onGetFocus:NO];
|
||||
[MWMRouterSavedState store];
|
||||
GetFramework().SetRenderingDisabled(false);
|
||||
// On some devices we have to free all belong-to-graphics memory
|
||||
// because of new OpenGL driver powered by Metal.
|
||||
if (YES) //TODO @igrechuhin: if a device is iPhone 6S and higher.
|
||||
{
|
||||
GetFramework().SetRenderingDisabled(true);
|
||||
GetFramework().OnDestroyGLContext();
|
||||
}
|
||||
else
|
||||
{
|
||||
GetFramework().SetRenderingDisabled(false);
|
||||
}
|
||||
[MWMLocationManager applicationWillResignActive];
|
||||
}
|
||||
|
||||
|
@ -663,6 +673,13 @@ using namespace osm_auth_ios;
|
|||
[self handleURLs];
|
||||
[[Statistics instance] applicationDidBecomeActive];
|
||||
GetFramework().SetRenderingEnabled();
|
||||
// On some devices we have to free all belong-to-graphics memory
|
||||
// because of new OpenGL driver powered by Metal.
|
||||
if (YES) //TODO @igrechuhin: if a device is iPhone 6S and higher.
|
||||
{
|
||||
m2::PointU size = GetFramework().GetViewportPixelSize();
|
||||
GetFramework().OnRecoverGLContext(static_cast<int>(size.x), static_cast<int>(size.y));
|
||||
}
|
||||
[MWMLocationManager applicationDidBecomeActive];
|
||||
[MWMRouterSavedState restore];
|
||||
[MWMSearch addCategoriesToSpotlight];
|
||||
|
|
|
@ -1048,6 +1048,12 @@ m2::PointD Framework::GetPixelCenter() const
|
|||
: m_currentModelView.PixelRect().Center();
|
||||
}
|
||||
|
||||
m2::PointU Framework::GetViewportPixelSize() const
|
||||
{
|
||||
auto & rect = m_currentModelView.PixelRect();
|
||||
return m2::PointU(static_cast<uint32_t>(rect.SizeX()), static_cast<uint32_t>(rect.SizeY()));
|
||||
}
|
||||
|
||||
m2::PointD Framework::GetVisiblePixelCenter() const
|
||||
{
|
||||
return m_visibleViewport.Center();
|
||||
|
|
|
@ -565,6 +565,7 @@ public:
|
|||
|
||||
m2::PointD GetPixelCenter() const;
|
||||
m2::PointD GetVisiblePixelCenter() const;
|
||||
m2::PointU GetViewportPixelSize() const;
|
||||
|
||||
m2::PointD const & GetViewportCenter() const;
|
||||
void SetViewportCenter(m2::PointD const & pt);
|
||||
|
|
Loading…
Add table
Reference in a new issue