summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2019-10-03 16:36:16 -0400
committerJulian Rex <julian.rex@mapbox.com>2019-10-03 16:41:41 -0400
commit2105fd14a88b66acbe35ebb787d68af5f0e0f259 (patch)
tree20fc8d2e2946c7da5f5c784d4fb5ddc57c64e4dd
parentbe580a4bbf6f829d31ecfe86af520baee2d8960d (diff)
downloadqtlocation-mapboxgl-2105fd14a88b66acbe35ebb787d68af5f0e0f259.tar.gz
[ios, macos] Update file lists & mac contexts
-rw-r--r--platform/darwin/src/MGLMapSnapshotter.mm10
-rw-r--r--platform/ios/sdk-files.json1
2 files changed, 8 insertions, 3 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm
index b44d873d85..b535178404 100644
--- a/platform/darwin/src/MGLMapSnapshotter.mm
+++ b/platform/darwin/src/MGLMapSnapshotter.mm
@@ -76,12 +76,14 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
- (NSPoint)pointForCoordinate:(CLLocationCoordinate2D)coordinate
{
mbgl::ScreenCoordinate sc = _pointForFn(MGLLatLngFromLocationCoordinate2D(coordinate));
- return NSMakePoint(sc.x, self.image.size.height - sc.y);
+ CGFloat height = (CGFloat)CGBitmapContextGetHeight(self.context);
+ return NSMakePoint(sc.x, height - sc.y);
}
- (CLLocationCoordinate2D)coordinateForPoint:(NSPoint)point
{
- auto screenCoord = mbgl::ScreenCoordinate(point.x, self.image.size.height - point.y);
+ CGFloat height = (CGFloat)CGBitmapContextGetHeight(self.context);
+ auto screenCoord = mbgl::ScreenCoordinate(point.x, height - point.y);
mbgl::LatLng latLng = _latLngForFn(screenCoord);
return MGLLocationCoordinate2DFromLatLng(latLng);
}
@@ -448,7 +450,9 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
if (currentContext && overlayHandler) {
- MGLMapSnapshotOverlay *snapshotOverlay = [[MGLMapSnapshotOverlay alloc] initWithContext:currentContext.CGContext];
+ MGLMapSnapshotOverlay *snapshotOverlay = [[MGLMapSnapshotOverlay alloc] initWithContext:currentContext.CGContext
+ pointForFn:pointForFn
+ latLngForFn:latLngForFn];
[currentContext saveGraphicsState];
overlayHandler(snapshotOverlay);
[currentContext restoreGraphicsState];
diff --git a/platform/ios/sdk-files.json b/platform/ios/sdk-files.json
index 0df4b381ba..dc59e179c8 100644
--- a/platform/ios/sdk-files.json
+++ b/platform/ios/sdk-files.json
@@ -243,6 +243,7 @@
"MMEDate.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEDate.h",
"NSString+MGLAdditions.h": "platform/darwin/src/NSString+MGLAdditions.h",
"UIDevice+MGLAdditions.h": "platform/ios/src/UIDevice+MGLAdditions.h",
+ "MGLMapSnapshotter_Private.h": "platform/darwin/src/MGLMapSnapshotter_Private.h",
"MGLRendererFrontend.h": "platform/darwin/src/MGLRendererFrontend.h",
"MGLStyleValue_Private.h": "platform/darwin/src/MGLStyleValue_Private.h",
"MGLFillExtrusionStyleLayer_Private.h": "platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h",