summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLMapSnapshotter.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLMapSnapshotter.mm')
-rw-r--r--platform/darwin/src/MGLMapSnapshotter.mm15
1 files changed, 12 insertions, 3 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm
index 3918008b78..171f24e4d0 100644
--- a/platform/darwin/src/MGLMapSnapshotter.mm
+++ b/platform/darwin/src/MGLMapSnapshotter.mm
@@ -3,8 +3,10 @@
#import <mbgl/actor/actor.hpp>
#import <mbgl/actor/scheduler.hpp>
#import <mbgl/util/geo.hpp>
+#import <mbgl/map/map_options.hpp>
#import <mbgl/map/map_snapshotter.hpp>
#import <mbgl/map/camera.hpp>
+#import <mbgl/storage/resource_options.hpp>
#import <mbgl/storage/default_file_source.hpp>
#import <mbgl/util/default_thread_pool.hpp>
#import <mbgl/util/string.hpp>
@@ -587,7 +589,9 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
_cancelled = NO;
_options = options;
- mbgl::DefaultFileSource *mbglFileSource = [MGLOfflineStorage sharedOfflineStorage].mbglFileSource;
+
+ auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource];
+
_mbglThreadPool = mbgl::sharedThreadPool();
std::string styleURL = std::string([options.styleURL.absoluteString UTF8String]);
@@ -619,9 +623,14 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
// App-global configuration
MGLRendererConfiguration* config = [MGLRendererConfiguration currentConfiguration];
-
+
+ mbgl::ResourceOptions resourceOptions;
+ resourceOptions.withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath])
+ .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String);
+
// Create the snapshotter
- _mbglMapSnapshotter = std::make_unique<mbgl::MapSnapshotter>(mbglFileSource, _mbglThreadPool, style, size, pixelRatio, cameraOptions, coordinateBounds, config.cacheDir, config.localFontFamilyName);
+ _mbglMapSnapshotter = std::make_unique<mbgl::MapSnapshotter>(
+ _mbglThreadPool, style, size, pixelRatio, cameraOptions, coordinateBounds, config.cacheDir, config.localFontFamilyName, resourceOptions);
}
@end