diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-02-27 18:33:16 +0100 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-03-23 14:50:11 -0700 |
commit | 8e5214144ec4f3a4fb40b7a7e4d8f09fd10dbb78 (patch) | |
tree | cf79b67b4af670438cbc79a524be82e88da83904 /include | |
parent | d7227e13a7a87cf50a4c8c1f0615fc565f5a2679 (diff) | |
download | qtlocation-mapboxgl-8e5214144ec4f3a4fb40b7a7e4d8f09fd10dbb78.tar.gz |
[core] Ensure that a BackendScope exists when doing GL calls
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/map/backend_scope.hpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/mbgl/map/backend_scope.hpp b/include/mbgl/map/backend_scope.hpp index 5a207e6ac4..4985cd197f 100644 --- a/include/mbgl/map/backend_scope.hpp +++ b/include/mbgl/map/backend_scope.hpp @@ -6,13 +6,26 @@ class Backend; class BackendScope { public: - BackendScope(Backend&); + // 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(Backend&, ScopeType = ScopeType::Explicit); ~BackendScope(); + // Returns true when there is currently a BackendScope active in this thread. + static bool exists(); + private: BackendScope* priorScope; BackendScope* nextScope; Backend& backend; + const ScopeType scopeType; }; } // namespace mbgl |