summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2019-03-29 00:34:13 -0400
committerJulian Rex <julian.rex@mapbox.com>2019-04-02 09:12:53 -0400
commit9fb0cf28b142988e4b44f56da6177e188b4a1e6a (patch)
tree5c11a2d73a49919f264e2017ea64ad011cb7b704
parent2fed2155c58bf8dfaa00062928f766fd848163a0 (diff)
downloadqtlocation-mapboxgl-9fb0cf28b142988e4b44f56da6177e188b4a1e6a.tar.gz
[ios] Enable/disable presentsWithTransaction when moving to/from a window.
-rw-r--r--platform/ios/src/MGLMapView.mm25
1 files changed, 24 insertions, 1 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index c94cf477ef..89fc1e8fab 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1234,12 +1234,35 @@ public:
- (void)willMoveToWindow:(UIWindow *)newWindow {
[super willMoveToWindow:newWindow];
[self refreshSupportedInterfaceOrientationsWithWindow:newWindow];
+
+ if (!newWindow)
+ {
+ // See https://github.com/mapbox/mapbox-gl-native/issues/14232
+ // In iOS 12.2, CAEAGLLayer.presentsWithTransaction can cause dramatic
+ // slow down. The exact cause of this is unknown, but this work around
+ // appears to lessen the effects.
+ //
+ // Also, consider calling the new mbgl::Renderer::flush()
+ CAEAGLLayer *eaglLayer = MGL_OBJC_DYNAMIC_CAST(_glView.layer, CAEAGLLayer);
+ eaglLayer.presentsWithTransaction = NO;
+
+ // Moved from didMoveToWindow
+ [self validateDisplayLink];
+ }
}
- (void)didMoveToWindow
{
- [self validateDisplayLink];
[super didMoveToWindow];
+
+ if (self.window)
+ {
+ // See above comment
+ CAEAGLLayer *eaglLayer = MGL_OBJC_DYNAMIC_CAST(_glView.layer, CAEAGLLayer);
+ eaglLayer.presentsWithTransaction = YES;
+
+ [self validateDisplayLink];
+ }
}
- (void)didMoveToSuperview