summaryrefslogtreecommitdiff
path: root/src/mbgl/map
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-07-05 20:08:51 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-07-18 10:45:12 +0200
commit46c43510d7ac5fe078010d5f0f5d39c4d5df3305 (patch)
tree5dc78959e174dc0e83198a4d92e86f65f33bb168 /src/mbgl/map
parentee205ca9ca3f808fa2cc16295ebde0a7c3867381 (diff)
downloadqtlocation-mapboxgl-46c43510d7ac5fe078010d5f0f5d39c4d5df3305.tar.gz
[core] rename backend to renderer backend
Diffstat (limited to 'src/mbgl/map')
-rw-r--r--src/mbgl/map/backend.cpp69
-rw-r--r--src/mbgl/map/backend_scope.cpp47
2 files changed, 0 insertions, 116 deletions
diff --git a/src/mbgl/map/backend.cpp b/src/mbgl/map/backend.cpp
deleted file mode 100644
index 83c2fed00b..0000000000
--- a/src/mbgl/map/backend.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <mbgl/map/backend.hpp>
-#include <mbgl/map/backend_scope.hpp>
-#include <mbgl/gl/context.hpp>
-#include <mbgl/gl/extension.hpp>
-#include <mbgl/gl/debugging.hpp>
-
-#include <cassert>
-
-namespace mbgl {
-
-Backend::Backend() = default;
-
-gl::Context& Backend::getContext() {
- assert(BackendScope::exists());
- std::call_once(initialized, [this] {
- context = std::make_unique<gl::Context>();
- context->enableDebugging();
- context->initializeExtensions(
- std::bind(&Backend::initializeExtension, this, std::placeholders::_1));
- });
- 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::assumeViewport(int32_t x, int32_t y, const Size& size) {
- getContext().viewport.setCurrentValue({ x, y, size });
- assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue());
-}
-
-void Backend::assumeScissorTest(bool enabled) {
- getContext().scissorTest.setCurrentValue(enabled);
- assert(gl::value::ScissorTest::Get() == getContext().scissorTest.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::setViewport(int32_t x, int32_t y, const Size& size) {
- getContext().viewport = { x, y, size };
- assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue());
-}
-
-void Backend::setScissorTest(bool enabled) {
- getContext().scissorTest = enabled;
- assert(gl::value::ScissorTest::Get() == getContext().scissorTest.getCurrentValue());
-}
-
-Backend::~Backend() = default;
-
-} // namespace mbgl
diff --git a/src/mbgl/map/backend_scope.cpp b/src/mbgl/map/backend_scope.cpp
deleted file mode 100644
index 824ad4498b..0000000000
--- a/src/mbgl/map/backend_scope.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <mbgl/map/backend_scope.hpp>
-#include <mbgl/map/backend.hpp>
-#include <mbgl/util/thread_local.hpp>
-
-#include <cassert>
-
-namespace mbgl {
-
-static util::ThreadLocal<BackendScope> currentScope;
-
-BackendScope::BackendScope(Backend& backend_, ScopeType scopeType_)
- : priorScope(currentScope.get()),
- nextScope(nullptr),
- backend(backend_),
- scopeType(scopeType_) {
- if (priorScope) {
- assert(priorScope->nextScope == nullptr);
- priorScope->nextScope = this;
- }
- if (scopeType == ScopeType::Explicit) {
- backend.activate();
- }
-
- currentScope.set(this);
-}
-
-BackendScope::~BackendScope() {
- assert(nextScope == nullptr);
- if (priorScope) {
- priorScope->backend.activate();
- currentScope.set(priorScope);
- assert(priorScope->nextScope == this);
- priorScope->nextScope = nullptr;
- } else {
- if (scopeType == ScopeType::Explicit) {
- backend.deactivate();
- }
-
- currentScope.set(nullptr);
- }
-}
-
-bool BackendScope::exists() {
- return currentScope.get();
-}
-
-} // namespace mbgl