summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-03-22 14:20:35 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-03-28 13:53:19 +0200
commita84aa453a9124867cb285f012abd97077ab2a019 (patch)
tree6181d5a39960df96e6dcd2d5c9d905c537b964fe /src
parent3f0f4575e77ef289ca209323c0000cf743ab9db2 (diff)
downloadqtlocation-mapboxgl-a84aa453a9124867cb285f012abd97077ab2a019.tar.gz
[core] Privatize OpenGL/Context headers
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/backend.cpp32
-rw-r--r--src/mbgl/map/map.cpp4
2 files changed, 36 insertions, 0 deletions
diff --git a/src/mbgl/map/backend.cpp b/src/mbgl/map/backend.cpp
index c228719ba6..0b4fd01050 100644
--- a/src/mbgl/map/backend.cpp
+++ b/src/mbgl/map/backend.cpp
@@ -21,6 +21,38 @@ gl::Context& Backend::getContext() {
return *context;
}
+PremultipliedImage Backend::readFramebuffer(const Size& size) const {
+ assert(context);
+ return context->readFramebuffer<PremultipliedImage>(size);
+}
+
+void Backend::assumeFramebufferBinding(const gl::FramebufferID fbo) {
+ getContext().bindFramebuffer.setCurrentValue(fbo);
+ if (fbo != ImplicitFramebufferBinding) {
+ assert(gl::value::BindFramebuffer::Get() == getContext().bindFramebuffer.getCurrentValue());
+ }
+}
+void Backend::assumeViewportSize(const Size& size) {
+ getContext().viewport.setCurrentValue({ 0, 0, size });
+ assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue());
+}
+
+bool Backend::implicitFramebufferBound() {
+ return getContext().bindFramebuffer.getCurrentValue() == ImplicitFramebufferBinding;
+}
+
+void Backend::setFramebufferBinding(const gl::FramebufferID fbo) {
+ getContext().bindFramebuffer = fbo;
+ if (fbo != ImplicitFramebufferBinding) {
+ assert(gl::value::BindFramebuffer::Get() == getContext().bindFramebuffer.getCurrentValue());
+ }
+}
+
+void Backend::setViewportSize(const Size& size) {
+ getContext().viewport = { 0, 0, size };
+ assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue());
+}
+
Backend::~Backend() = default;
} // namespace mbgl
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 9e0b1a7575..8957f3272e 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -285,6 +285,8 @@ void Map::Impl::render(View& view) {
contextMode,
debugOptions };
+ backend.updateAssumedState();
+
painter->render(*style,
frameData,
view,
@@ -323,6 +325,8 @@ void Map::Impl::render(View& view) {
contextMode,
debugOptions };
+ backend.updateAssumedState();
+
try {
painter->render(*style,
frameData,