diff options
author | Julian Rex <julian.rex@mapbox.com> | 2019-03-29 00:34:13 -0400 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2019-03-29 00:34:13 -0400 |
commit | b5c886232cbab9e4c8b5e46c0b76950cf08da627 (patch) | |
tree | d6f6001a932fef58862239c2c96c327d5d6edd11 | |
parent | 4e335d0b050c6d5b94ae0d28cb4fd36b939ad84b (diff) | |
download | qtlocation-mapboxgl-b5c886232cbab9e4c8b5e46c0b76950cf08da627.tar.gz |
[ios] Enable/disable presentsWithTransaction when moving to/from a window.
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 25 |
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 |