summaryrefslogtreecommitdiff
path: root/platform/macos/app
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-05-17 11:47:31 -0400
committerFabian Guerra <fabian.guerra@mapbox.com>2018-05-17 11:47:31 -0400
commit30376f3ce1d17522d9e64901b1bbc52906ee5267 (patch)
tree1f00d04a223a76a86e16ddebc77f56d2cff88b5b /platform/macos/app
parent7d1e52a3255d4eecdcd37e4fb600eb76fa9333f8 (diff)
parent146057adf90e85e3edc80446f02d20e5f6cab378 (diff)
downloadqtlocation-mapboxgl-upstream/fabian-merge-release-4.0.1-master.tar.gz
Merge branch 'release-boba' into masterupstream/fabian-merge-release-4.0.1-master
# Conflicts: # mapbox-gl-js # platform/android/CHANGELOG.md # platform/android/MapboxGLAndroidSDK/gradle.properties # platform/android/gradle/dependencies.gradle # platform/darwin/src/MGLVectorTileSource.mm # platform/darwin/src/MGLVectorTileSource_Private.h # platform/ios/CHANGELOG.md # src/mbgl/style/expression/compound_expression.cpp
Diffstat (limited to 'platform/macos/app')
-rw-r--r--platform/macos/app/LimeGreenStyleLayer.h5
-rw-r--r--platform/macos/app/LimeGreenStyleLayer.m60
-rw-r--r--platform/macos/app/MapDocument.m24
-rw-r--r--platform/macos/app/ko.lproj/Localizable.strings0
4 files changed, 15 insertions, 74 deletions
diff --git a/platform/macos/app/LimeGreenStyleLayer.h b/platform/macos/app/LimeGreenStyleLayer.h
deleted file mode 100644
index 35480963a4..0000000000
--- a/platform/macos/app/LimeGreenStyleLayer.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#import <Mapbox/Mapbox.h>
-
-@interface LimeGreenStyleLayer : MGLOpenGLStyleLayer
-
-@end
diff --git a/platform/macos/app/LimeGreenStyleLayer.m b/platform/macos/app/LimeGreenStyleLayer.m
deleted file mode 100644
index 40c336cd98..0000000000
--- a/platform/macos/app/LimeGreenStyleLayer.m
+++ /dev/null
@@ -1,60 +0,0 @@
-#import "LimeGreenStyleLayer.h"
-
-#include <OpenGL/gl.h>
-#include <OpenGL/glext.h>
-
-@implementation LimeGreenStyleLayer {
- GLuint _program;
- GLuint _vertexShader;
- GLuint _fragmentShader;
- GLuint _buffer;
- GLuint _aPos;
-}
-
-- (void)didMoveToMapView:(MGLMapView *)mapView {
- static const GLchar *vertexShaderSource = "attribute vec2 a_pos; void main() { gl_Position = vec4(a_pos, 0, 1); }";
- static const GLchar *fragmentShaderSource = "void main() { gl_FragColor = vec4(0, 1, 0, 1); }";
-
- _program = glCreateProgram();
- _vertexShader = glCreateShader(GL_VERTEX_SHADER);
- _fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
-
- glShaderSource(_vertexShader, 1, &vertexShaderSource, NULL);
- glCompileShader(_vertexShader);
- glAttachShader(_program, _vertexShader);
- glShaderSource(_fragmentShader, 1, &fragmentShaderSource, NULL);
- glCompileShader(_fragmentShader);
- glAttachShader(_program, _fragmentShader);
- glLinkProgram(_program);
- _aPos = glGetAttribLocation(_program, "a_pos");
-
- GLfloat background[] = { -1,-1, 1,-1, -1,1, 1,1 };
- glGenBuffers(1, &_buffer);
- glBindBuffer(GL_ARRAY_BUFFER, _buffer);
- glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), background, GL_STATIC_DRAW);
-}
-
-- (void)drawInMapView:(MGLMapView *)mapView withContext:(MGLStyleLayerDrawingContext)context {
- glUseProgram(_program);
- glBindBuffer(GL_ARRAY_BUFFER, _buffer);
- glEnableVertexAttribArray(_aPos);
- glVertexAttribPointer(_aPos, 2, GL_FLOAT, GL_FALSE, 0, NULL);
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_DEPTH_TEST);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-}
-
-- (void)willMoveFromMapView:(MGLMapView *)mapView {
- if (!_program) {
- return;
- }
-
- glDeleteBuffers(1, &_buffer);
- glDetachShader(_program, _vertexShader);
- glDetachShader(_program, _fragmentShader);
- glDeleteShader(_vertexShader);
- glDeleteShader(_fragmentShader);
- glDeleteProgram(_program);
-}
-
-@end
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m
index 7be500ae6a..4ee6050565 100644
--- a/platform/macos/app/MapDocument.m
+++ b/platform/macos/app/MapDocument.m
@@ -93,9 +93,8 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
BOOL _isTouringWorld;
BOOL _isShowingPolygonAndPolylineAnnotations;
BOOL _isShowingAnimatedAnnotation;
-
- // Snapshotter
- MGLMapSnapshotter* snapshotter;
+
+ MGLMapSnapshotter *_snapshotter;
}
#pragma mark Lifecycle
@@ -185,17 +184,23 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
options.zoomLevel = self.mapView.zoomLevel;
// Create and start the snapshotter
- snapshotter = [[MGLMapSnapshotter alloc] initWithOptions:options];
- [snapshotter startWithCompletionHandler:^(MGLMapSnapshot *snapshot, NSError *error) {
+ __weak __typeof__(self) weakSelf = self;
+ _snapshotter = [[MGLMapSnapshotter alloc] initWithOptions:options];
+ [_snapshotter startWithCompletionHandler:^(MGLMapSnapshot *snapshot, NSError *error) {
+ __typeof__(self) strongSelf = weakSelf;
+ if (!strongSelf) {
+ return;
+ }
+
if (error) {
NSLog(@"Could not load snapshot: %@", error.localizedDescription);
} else {
// Set the default name for the file and show the panel.
NSSavePanel *panel = [NSSavePanel savePanel];
- panel.nameFieldStringValue = [self.mapView.styleURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingPathExtension:@"png"];
+ panel.nameFieldStringValue = [strongSelf.mapView.styleURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingPathExtension:@"png"];
panel.allowedFileTypes = [@[(NSString *)kUTTypePNG] arrayByAddingObjectsFromArray:[NSBitmapImageRep imageUnfilteredTypes]];
- [panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
+ [panel beginSheetModalForWindow:strongSelf.window completionHandler:^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton) {
// Write the contents in the new format.
NSURL *fileURL = panel.URL;
@@ -232,7 +237,8 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
}];
}
- snapshotter = nil;
+
+ strongSelf->_snapshotter = nil;
}];
}
@@ -1179,7 +1185,7 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
return YES;
}
if (menuItem.action == @selector(takeSnapshot:)) {
- return !(snapshotter && [snapshotter isLoading]);
+ return !(_snapshotter && [_snapshotter isLoading]);
}
return NO;
}
diff --git a/platform/macos/app/ko.lproj/Localizable.strings b/platform/macos/app/ko.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/ko.lproj/Localizable.strings