forked from organicmaps/organicmaps
Fixed iOS landscape <-> portrait transition visual bugs
This commit is contained in:
parent
7c4ef8dbf9
commit
5f47418268
3 changed files with 50 additions and 29 deletions
|
@ -820,27 +820,40 @@ void FrontendRenderer::Routine::Do()
|
|||
|
||||
my::HighResTimer timer;
|
||||
timer.Reset();
|
||||
|
||||
double frameTime = 0.0;
|
||||
int inactiveFrameCount = 0;
|
||||
bool viewChanged = true;
|
||||
ScreenBase modelView = m_renderer.UpdateScene(viewChanged);
|
||||
bool modelViewChanged = true;
|
||||
bool viewportChanged = true;
|
||||
|
||||
while (!IsCancelled())
|
||||
{
|
||||
ScreenBase modelView = m_renderer.ProcessEvents(modelViewChanged, viewportChanged);
|
||||
if (viewportChanged)
|
||||
m_renderer.OnResize(modelView);
|
||||
|
||||
context->setDefaultFramebuffer();
|
||||
|
||||
if (modelViewChanged || viewportChanged)
|
||||
m_renderer.PrepareScene(modelView);
|
||||
|
||||
bool const hasAsyncRoutines = m_renderer.m_texMng->UpdateDynamicTextures();
|
||||
m_renderer.RenderScene(modelView);
|
||||
|
||||
bool const animActive = InterpolationHolder::Instance().Advance(frameTime);
|
||||
modelView = m_renderer.UpdateScene(viewChanged);
|
||||
|
||||
if (modelViewChanged)
|
||||
{
|
||||
m_renderer.UpdateScene(modelView);
|
||||
m_renderer.EmitModelViewChanged(modelView);
|
||||
}
|
||||
|
||||
bool const waitCompletion = m_renderer.m_userEventStream.IsWaitingForActionCompletion();
|
||||
|
||||
// Check for a frame is inactive.
|
||||
bool const isInactiveFrame = !viewChanged && m_renderer.IsQueueEmpty() &&
|
||||
bool const isInactiveFrame = !modelViewChanged && !viewportChanged &&
|
||||
!animActive && !hasAsyncRoutines &&
|
||||
!waitCompletion;
|
||||
!waitCompletion && m_renderer.IsQueueEmpty();
|
||||
if (isInactiveFrame)
|
||||
++inactiveFrameCount;
|
||||
else
|
||||
|
@ -923,32 +936,30 @@ void FrontendRenderer::ChangeModelView(m2::PointD const & userPos, double azimut
|
|||
AddUserEvent(FollowAndRotateEvent(userPos, pxZero, azimuth, preferredZoomLevel, true));
|
||||
}
|
||||
|
||||
ScreenBase const & FrontendRenderer::UpdateScene(bool & modelViewChanged)
|
||||
ScreenBase const & FrontendRenderer::ProcessEvents(bool & modelViewChanged, bool & viewportChanged)
|
||||
{
|
||||
bool viewportChanged;
|
||||
ScreenBase const & modelView = m_userEventStream.ProcessEvents(modelViewChanged, viewportChanged);
|
||||
gui::DrapeGui::Instance().SetInUserAction(m_userEventStream.IsInUserAction());
|
||||
if (viewportChanged)
|
||||
OnResize(modelView);
|
||||
|
||||
if (modelViewChanged)
|
||||
{
|
||||
ResolveZoomLevel(modelView);
|
||||
TTilesCollection tiles;
|
||||
ResolveTileKeys(modelView, tiles);
|
||||
|
||||
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<UpdateReadManagerMessage>(modelView, move(tiles)),
|
||||
MessagePriority::High);
|
||||
|
||||
RefreshModelView(modelView);
|
||||
RefreshBgColor();
|
||||
EmitModelViewChanged(modelView);
|
||||
}
|
||||
|
||||
return modelView;
|
||||
}
|
||||
|
||||
void FrontendRenderer::PrepareScene(ScreenBase const & modelView)
|
||||
{
|
||||
RefreshModelView(modelView);
|
||||
RefreshBgColor();
|
||||
}
|
||||
|
||||
void FrontendRenderer::UpdateScene(ScreenBase const & modelView)
|
||||
{
|
||||
ResolveZoomLevel(modelView);
|
||||
TTilesCollection tiles;
|
||||
ResolveTileKeys(modelView, tiles);
|
||||
|
||||
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<UpdateReadManagerMessage>(modelView, move(tiles)),
|
||||
MessagePriority::High);
|
||||
}
|
||||
|
||||
void FrontendRenderer::EmitModelViewChanged(ScreenBase const & modelView) const
|
||||
{
|
||||
m_modelViewChangedFn(modelView);
|
||||
|
|
|
@ -133,7 +133,10 @@ private:
|
|||
void RefreshProjection();
|
||||
void RefreshModelView(ScreenBase const & screen);
|
||||
void RefreshBgColor();
|
||||
ScreenBase const & UpdateScene(bool & modelViewChanged);
|
||||
|
||||
ScreenBase const & ProcessEvents(bool & modelViewChanged, bool & viewportChanged);
|
||||
void PrepareScene(ScreenBase const & modelView);
|
||||
void UpdateScene(ScreenBase const & modelView);
|
||||
|
||||
void EmitModelViewChanged(ScreenBase const & modelView) const;
|
||||
|
||||
|
|
|
@ -77,6 +77,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)applyOnSize:(int)width withHeight:(int)height
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^
|
||||
{
|
||||
GetFramework().OnSize(width, height);
|
||||
[self.widgetsManager resize:CGSizeMake(width, height)];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)onSize:(int)width withHeight:(int)height
|
||||
{
|
||||
int w = width * self.contentScaleFactor;
|
||||
|
@ -89,9 +98,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
GetFramework().OnSize(w, h);
|
||||
|
||||
[self.widgetsManager resize:CGSizeMake(w, h)];
|
||||
[self applyOnSize:w withHeight:h];
|
||||
}
|
||||
|
||||
- (double)correctContentScale
|
||||
|
|
Loading…
Add table
Reference in a new issue