Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[macos] test app - adapt to MGLMapSnapshot wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ivovandongen committed Oct 9, 2017
1 parent dceeef3 commit d93b9b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions platform/macos/app/MapDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ - (IBAction)takeSnapshot:(id)sender {

// Create and start the snapshotter
snapshotter = [[MGLMapSnapshotter alloc] initWithOptions:options];
[snapshotter startWithCompletionHandler:^(NSImage *image, NSError *error) {
[snapshotter startWithCompletionHandler:^(MGLMapSnapshot *snapshot, NSError *error) {
if (error) {
NSLog(@"Could not load snapshot: %@", error.localizedDescription);
} else {
Expand All @@ -182,15 +182,15 @@ - (IBAction)takeSnapshot:(id)sender {
NSURL *fileURL = panel.URL;

NSBitmapImageRep *bitmapRep;
for (NSImageRep *imageRep in image.representations) {
for (NSImageRep *imageRep in snapshot.image.representations) {
if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) {
bitmapRep = (NSBitmapImageRep *)imageRep;
break; // stop on first bitmap rep we find
}
}

if (!bitmapRep) {
bitmapRep = [NSBitmapImageRep imageRepWithData:image.TIFFRepresentation];
bitmapRep = [NSBitmapImageRep imageRepWithData:snapshot.image.TIFFRepresentation];
}

CFStringRef uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileURL.pathExtension, NULL /* inConformingToUTI */);
Expand Down

0 comments on commit d93b9b5

Please sign in to comment.