summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-02-09 12:08:23 +0100
committerMinh Nguyễn <mxn@1ec5.org>2017-02-20 12:34:05 -0800
commite5b9605ab2dc8fd73bdc44ff0d40034d326c1bdf (patch)
treeda3796e343ba0b0a8c62cc41068029cec41be2ff /platform
parent4eef3df183bb74ca02b6b40cc21ecd5cbf4694b4 (diff)
downloadqtlocation-mapboxgl-e5b9605ab2dc8fd73bdc44ff0d40034d326c1bdf.tar.gz
[macos] reuse OpenGL context when switching screens
Cherry-picked from 43e81509fb0be54bea5912fb5a10bfa0e0667a44.
Diffstat (limited to 'platform')
-rw-r--r--platform/macos/CHANGELOG.md1
-rw-r--r--platform/macos/src/MGLOpenGLLayer.mm11
2 files changed, 11 insertions, 1 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index e1a1bad4cc..e6a7ea2ca5 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -5,6 +5,7 @@
This version of the Mapbox macOS SDK corresponds to version 3.4.2 of the Mapbox iOS SDK. The two SDKs have very similar feature sets. The main differences are the lack of user location tracking and annotation views. Some APIs have been adapted to macOS conventions, particularly the use of NSPopover for callout views.
* Fixed an issue causing MGLMapView’s `camera`’s `heading` to be set to a negative value, indicating an undefined heading, when the map view faces northwest. The heading is now wrapped to between zero and 360 degrees, for consistency with MGLMapView’s `direction` property. ([#7724](https://github.com/mapbox/mapbox-gl-native/pull/7724))
+* Fixed a crash that occurred when moving a window containing an MGLMapView from one screen to another. ([#8004](https://github.com/mapbox/mapbox-gl-native/pull/8004))
* Fixed an issue preventing the use of the integrated GPU on machines that have more than one GPU. Follow the instructions in [Technical Q&A 1734](https://developer.apple.com/library/content/qa/qa1734/_index.html) to enable integrated GPU usage in your application. ([#7834](https://github.com/mapbox/mapbox-gl-native/pull/7834))
* Fixed an issue causing the mouse cursor to jump after shift- or option-dragging a map view if the window opened on a screen with a different size than the screen with keyboard focus. ([#7846](https://github.com/mapbox/mapbox-gl-native/pull/7846))
* Deprecated the style class methods in MGLStyle. ([#7785](https://github.com/mapbox/mapbox-gl-native/pull/7785))
diff --git a/platform/macos/src/MGLOpenGLLayer.mm b/platform/macos/src/MGLOpenGLLayer.mm
index 654fa4f2bc..b1040f26e8 100644
--- a/platform/macos/src/MGLOpenGLLayer.mm
+++ b/platform/macos/src/MGLOpenGLLayer.mm
@@ -4,7 +4,9 @@
#import <mbgl/gl/gl.hpp>
-@implementation MGLOpenGLLayer
+@implementation MGLOpenGLLayer {
+ NSOpenGLContext *_context;
+}
- (MGLMapView *)mapView {
return (MGLMapView *)super.view;
@@ -22,6 +24,13 @@
return self.view.bounds;
}
+- (NSOpenGLContext *)openGLContextForPixelFormat:(NSOpenGLPixelFormat *)pixelFormat {
+ if (!_context) {
+ _context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
+ }
+ return _context;
+}
+
- (NSOpenGLPixelFormat *)openGLPixelFormatForDisplayMask:(uint32_t)mask {
NSOpenGLPixelFormatAttribute pfas[] = {
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy,