diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/map/map.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/map/map_impl.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/map/map_impl.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/map/map_options.cpp | 12 |
4 files changed, 18 insertions, 8 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index cfec9952b5..b22a9ee2f2 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -29,12 +29,12 @@ using namespace style; Map::Map(RendererFrontend& frontend, MapObserver& observer, - const float pixelRatio, Scheduler& scheduler, const MapOptions& mapOptions, const ResourceOptions& resourceOptions) - : impl(std::make_unique<Impl>(frontend, observer, scheduler, pixelRatio, - FileSource::getSharedFileSource(resourceOptions), mapOptions)) {} + : impl(std::make_unique<Impl>(frontend, observer, scheduler, + FileSource::getSharedFileSource(resourceOptions), + mapOptions)) {} Map::Map(std::unique_ptr<Impl> impl_) : impl(std::move(impl_)) {} @@ -336,7 +336,8 @@ MapOptions Map::getMapOptions() const { .withViewportMode(impl->transform.getViewportMode()) .withCrossSourceCollisions(impl->crossSourceCollisions) .withNorthOrientation(impl->transform.getNorthOrientation()) - .withSize(impl->transform.getState().getSize())); + .withSize(impl->transform.getState().getSize()) + .withPixelRatio(impl->pixelRatio)); } #pragma mark - Projection mode diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index afaa05229c..42561cf8bf 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -10,7 +10,6 @@ namespace mbgl { Map::Impl::Impl(RendererFrontend& frontend_, MapObserver& observer_, Scheduler& scheduler_, - float pixelRatio_, std::shared_ptr<FileSource> fileSource_, const MapOptions& mapOptions) : observer(observer_), @@ -18,7 +17,7 @@ Map::Impl::Impl(RendererFrontend& frontend_, scheduler(scheduler_), transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()), mode(mapOptions.mapMode()), - pixelRatio(pixelRatio_), + pixelRatio(mapOptions.pixelRatio()), crossSourceCollisions(mapOptions.crossSourceCollisions()), fileSource(std::move(fileSource_)), style(std::make_unique<style::Style>(scheduler, *fileSource, pixelRatio)), diff --git a/src/mbgl/map/map_impl.hpp b/src/mbgl/map/map_impl.hpp index 90b0a721ca..7086148276 100644 --- a/src/mbgl/map/map_impl.hpp +++ b/src/mbgl/map/map_impl.hpp @@ -30,7 +30,7 @@ struct StillImageRequest { class Map::Impl : public style::Observer, public RendererObserver { public: - Impl(RendererFrontend&, MapObserver&, Scheduler&, float pixelRatio, std::shared_ptr<FileSource>, const MapOptions&); + Impl(RendererFrontend&, MapObserver&, Scheduler&, std::shared_ptr<FileSource>, const MapOptions&); ~Impl() final; // StyleObserver diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index 98cabb2550..4cebb6adab 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -9,7 +9,8 @@ public: ViewportMode viewportMode = ViewportMode::Default; NorthOrientation orientation = NorthOrientation::Upwards; bool crossSourceCollisions = true; - Size size; + Size size = { 64, 64 }; + float pixelRatio = 1.0; }; // These requires the complete type of Impl. @@ -71,4 +72,13 @@ Size MapOptions::size() const { return impl_->size; } +MapOptions& MapOptions::withPixelRatio(float ratio) { + impl_->pixelRatio = ratio; + return *this; +} + +float MapOptions::pixelRatio() const { + return impl_->pixelRatio; +} + } // namespace mbgl |