summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-10-31 19:45:17 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-11-01 10:46:04 +0100
commitf7801e5d82d272d53db6925a325391e5da5c842e (patch)
treec44b8d9cd6218b470406cfe09dc8dcf21a5a7b2d /platform/ios
parentdfd4057121fa4214d75158687d838d13bab02d19 (diff)
downloadqtlocation-mapboxgl-f7801e5d82d272d53db6925a325391e5da5c842e.tar.gz
[core] correctly set the framebuffer size on retina screens
Also asserts in Debug mode that the internal state and the OpenGL state are identical
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/src/MGLMapView.mm9
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 43f357559f..d392849522 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -549,6 +549,12 @@ public:
static_cast<uint32_t>(self.bounds.size.height) };
}
+- (mbgl::Size)framebufferSize
+{
+ return { static_cast<uint32_t>(self.glView.drawableWidth),
+ static_cast<uint32_t>(self.glView.drawableHeight) };
+}
+
- (void)createGLView
{
if (_context) return;
@@ -4953,7 +4959,7 @@ public:
}
mbgl::gl::value::Viewport::Type getViewport() const {
- return { 0, 0, nativeView.size };
+ return { 0, 0, nativeView.framebufferSize };
}
/// This function is called before we start rendering, when iOS invokes our rendering method.
@@ -4963,6 +4969,7 @@ public:
// We are using 0 as the placeholder value for the GLKView's framebuffer.
getContext().bindFramebuffer.setCurrentValue(0);
getContext().viewport.setCurrentValue(getViewport());
+ assert(mbgl::gl::value::Viewport::Get() == getContext().viewport.getCurrentValue());
}
void bind() override {