From 62b56b799a7d4fcd1a8f151eed878054b862da5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 26 Oct 2016 15:22:31 -0700 Subject: [core] change std::array to mbgl::Size --- platform/ios/src/MGLMapView.mm | 22 +++++++++++----------- platform/ios/src/UIImage+MGLAdditions.mm | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'platform/ios') diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 41e049ad61..43f357559f 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -399,12 +399,10 @@ public: [[NSFileManager defaultManager] removeItemAtPath:fileCachePath error:NULL]; // setup mbgl map - const std::array size = {{ static_cast(self.bounds.size.width), - static_cast(self.bounds.size.height) }}; mbgl::DefaultFileSource *mbglFileSource = [MGLOfflineStorage sharedOfflineStorage].mbglFileSource; const float scaleFactor = [UIScreen instancesRespondToSelector:@selector(nativeScale)] ? [[UIScreen mainScreen] nativeScale] : [[UIScreen mainScreen] scale]; _mbglThreadPool = new mbgl::ThreadPool(4); - _mbglMap = new mbgl::Map(*_mbglView, size, scaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::MapMode::Continuous, mbgl::GLContextMode::Unique, mbgl::ConstrainMode::None, mbgl::ViewportMode::Default); + _mbglMap = new mbgl::Map(*_mbglView, self.size, scaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::MapMode::Continuous, mbgl::GLContextMode::Unique, mbgl::ConstrainMode::None, mbgl::ViewportMode::Default); [self validateTileCacheSize]; // start paused if in IB @@ -545,6 +543,12 @@ public: } } +- (mbgl::Size)size +{ + return { static_cast(self.bounds.size.width), + static_cast(self.bounds.size.height) }; +} + - (void)createGLView { if (_context) return; @@ -885,10 +889,8 @@ public: [self adjustContentInset]; - if ( ! _isTargetingInterfaceBuilder) - { - _mbglMap->setSize({{ static_cast(self.bounds.size.width), - static_cast(self.bounds.size.height) }}); + if (!_isTargetingInterfaceBuilder) { + _mbglMap->setSize([self size]); } if (self.attributionSheet.visible) @@ -4947,13 +4949,11 @@ public: class MBGLView : public mbgl::View, public mbgl::Backend { public: - MBGLView(MGLMapView* nativeView_) - : nativeView(nativeView_) { + MBGLView(MGLMapView* nativeView_) : nativeView(nativeView_) { } mbgl::gl::value::Viewport::Type getViewport() const { - return { 0, 0, static_cast(nativeView.glView.drawableWidth), - static_cast(nativeView.glView.drawableHeight) }; + return { 0, 0, nativeView.size }; } /// This function is called before we start rendering, when iOS invokes our rendering method. diff --git a/platform/ios/src/UIImage+MGLAdditions.mm b/platform/ios/src/UIImage+MGLAdditions.mm index 8ec8f9e15f..215b23faff 100644 --- a/platform/ios/src/UIImage+MGLAdditions.mm +++ b/platform/ios/src/UIImage+MGLAdditions.mm @@ -8,7 +8,7 @@ size_t width = CGImageGetWidth(cgImage); size_t height = CGImageGetHeight(cgImage); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - mbgl::PremultipliedImage cPremultipliedImage(width, height); + mbgl::PremultipliedImage cPremultipliedImage({ static_cast(width), static_cast(height) }); size_t bytesPerPixel = 4; size_t bytesPerRow = bytesPerPixel * width; size_t bitsPerComponent = 8; -- cgit v1.2.1