summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mbgl/map/backend.hpp4
-rwxr-xr-xplatform/android/src/native_map_view.cpp6
-rw-r--r--platform/glfw/glfw_view.cpp4
-rw-r--r--platform/ios/src/MGLMapView.mm4
-rw-r--r--platform/macos/src/MGLMapView.mm4
-rw-r--r--platform/qt/src/qmapboxgl.cpp4
-rw-r--r--src/mbgl/map/backend.cpp9
7 files changed, 18 insertions, 17 deletions
diff --git a/include/mbgl/map/backend.hpp b/include/mbgl/map/backend.hpp
index 884c4b5256..23a75b82ae 100644
--- a/include/mbgl/map/backend.hpp
+++ b/include/mbgl/map/backend.hpp
@@ -61,7 +61,7 @@ protected:
// Tells the renderer that OpenGL state has already been set by the windowing toolkit.
// It sets the internal assumed state to the supplied values.
void assumeFramebufferBinding(gl::FramebufferID fbo);
- void assumeViewportSize(const Size&);
+ void assumeViewport(int32_t x, int32_t y, const Size&);
// Returns true when assumed framebuffer binding hasn't changed from the implicit binding.
bool implicitFramebufferBound();
@@ -69,7 +69,7 @@ protected:
// Triggers an OpenGL state update if the internal assumed state doesn't match the
// supplied values.
void setFramebufferBinding(gl::FramebufferID fbo);
- void setViewportSize(const Size&);
+ void setViewport(int32_t x, int32_t y, const Size&);
protected:
std::unique_ptr<gl::Context> context;
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index 73a4f96549..7696be5b18 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -109,7 +109,7 @@ NativeMapView::~NativeMapView() {
*/
void NativeMapView::bind() {
setFramebufferBinding(0);
- setViewportSize(getFramebufferSize());
+ setViewport(0, 0, getFramebufferSize());
}
/**
@@ -292,7 +292,7 @@ void NativeMapView::render(jni::JNIEnv& env) {
BackendScope guard(*this);
if (framebufferSizeChanged) {
- setViewportSize(getFramebufferSize());
+ setViewport(0, 0, getFramebufferSize());
framebufferSizeChanged = false;
}
@@ -1430,7 +1430,7 @@ mbgl::Size NativeMapView::getFramebufferSize() const {
void NativeMapView::updateAssumedState() {
assumeFramebufferBinding(0);
- assumeViewportSize(getFramebufferSize());
+ assumeViewport(0, 0, getFramebufferSize());
}
void NativeMapView::updateFps() {
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp
index c5d36a5555..4f878550b3 100644
--- a/platform/glfw/glfw_view.cpp
+++ b/platform/glfw/glfw_view.cpp
@@ -136,12 +136,12 @@ void GLFWView::setMap(mbgl::Map *map_) {
void GLFWView::updateAssumedState() {
assumeFramebufferBinding(0);
- assumeViewportSize(getFramebufferSize());
+ assumeViewport(0, 0, getFramebufferSize());
}
void GLFWView::bind() {
setFramebufferBinding(0);
- setViewportSize(getFramebufferSize());
+ setViewport(0, 0, getFramebufferSize());
}
void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, int mods) {
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 9a9f71d5c3..8ae3049e3e 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -5439,7 +5439,7 @@ public:
/// context state with the anticipated values.
void updateAssumedState() override {
assumeFramebufferBinding(ImplicitFramebufferBinding);
- assumeViewportSize(nativeView.framebufferSize);
+ assumeViewport(0, 0, nativeView.framebufferSize);
}
void bind() override {
@@ -5452,7 +5452,7 @@ public:
updateAssumedState();
} else {
// Our framebuffer is still bound, but the viewport might have changed.
- setViewportSize(nativeView.framebufferSize);
+ setViewport(0, 0, nativeView.framebufferSize);
}
}
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index c7f6e59c80..a8a84522a5 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -2888,12 +2888,12 @@ public:
void updateAssumedState() override {
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbo);
assumeFramebufferBinding(fbo);
- assumeViewportSize(nativeView.framebufferSize);
+ assumeViewport(0, 0, nativeView.framebufferSize);
}
void bind() override {
setFramebufferBinding(fbo);
- setViewportSize(nativeView.framebufferSize);
+ setViewport(0, 0, nativeView.framebufferSize);
}
mbgl::PremultipliedImage readStillImage() {
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index 01471bf733..7bc02c9d1c 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -1506,12 +1506,12 @@ mbgl::Size QMapboxGLPrivate::framebufferSize() const {
void QMapboxGLPrivate::updateAssumedState() {
assumeFramebufferBinding(fbObject);
- assumeViewportSize(framebufferSize());
+ assumeViewport(0, 0, framebufferSize());
}
void QMapboxGLPrivate::bind() {
setFramebufferBinding(fbObject);
- setViewportSize(framebufferSize());
+ setViewport(0, 0, framebufferSize());
}
void QMapboxGLPrivate::invalidate()
diff --git a/src/mbgl/map/backend.cpp b/src/mbgl/map/backend.cpp
index 0b4fd01050..4c84453c1f 100644
--- a/src/mbgl/map/backend.cpp
+++ b/src/mbgl/map/backend.cpp
@@ -32,8 +32,9 @@ void Backend::assumeFramebufferBinding(const gl::FramebufferID fbo) {
assert(gl::value::BindFramebuffer::Get() == getContext().bindFramebuffer.getCurrentValue());
}
}
-void Backend::assumeViewportSize(const Size& size) {
- getContext().viewport.setCurrentValue({ 0, 0, size });
+
+void Backend::assumeViewport(int32_t x, int32_t y, const Size& size) {
+ getContext().viewport.setCurrentValue({ x, y, size });
assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue());
}
@@ -48,8 +49,8 @@ void Backend::setFramebufferBinding(const gl::FramebufferID fbo) {
}
}
-void Backend::setViewportSize(const Size& size) {
- getContext().viewport = { 0, 0, size };
+void Backend::setViewport(int32_t x, int32_t y, const Size& size) {
+ getContext().viewport = { x, y, size };
assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue());
}