diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-04-01 15:57:44 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-04-05 11:49:17 +0200 |
commit | a782a6d15b80dd83105604f3f779f6c83ba222e5 (patch) | |
tree | 62d83196baf28554cdd3144691b8210cc998af4a /include/mbgl/gfx | |
parent | 865f8a6c03540e329ed6caef354799fb58b7ab6e (diff) | |
download | qtlocation-mapboxgl-a782a6d15b80dd83105604f3f779f6c83ba222e5.tar.gz |
[core] move BackendScope to gfx namespace
Diffstat (limited to 'include/mbgl/gfx')
-rw-r--r-- | include/mbgl/gfx/backend_scope.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/mbgl/gfx/backend_scope.hpp b/include/mbgl/gfx/backend_scope.hpp new file mode 100644 index 0000000000..b92334ae0f --- /dev/null +++ b/include/mbgl/gfx/backend_scope.hpp @@ -0,0 +1,38 @@ +#pragma once + +namespace mbgl { + +class RendererBackend; + +namespace gfx { + +class BackendScope { +public: + // There are two types of scopes: Creating an "Implicit" scope tells Mapbox GL that the + // supporting windowing system has already activated the GL Backend and that no further actions + // are required. Creating an "Explicit" scope actually enables the GL Backend, and disables it + // when the BackendScope is destroyed. + enum class ScopeType : bool { + Implicit, + Explicit, + }; + + BackendScope(RendererBackend&, ScopeType = ScopeType::Explicit); + ~BackendScope(); + + // Returns true when there is currently a BackendScope active in this thread. + static bool exists(); + +private: + void activate(); + void deactivate(); + + BackendScope* priorScope; + BackendScope* nextScope; + RendererBackend& backend; + const ScopeType scopeType; + bool activated = false; +}; + +} // namespace gfx +} // namespace mbgl |