1#pragma once
2
3namespace mbgl {
4
5class RendererBackend;
6
7class BackendScope {
8public:
9 // There are two types of scopes: Creating an "Implicit" scope tells Mapbox GL that the
10 // supporting windowing system has already activated the GL Backend and that no further actions
11 // are required. Creating an "Explicit" scope actually enables the GL Backend, and disables it
12 // when the BackendScope is destroyed.
13 enum class ScopeType : bool {
14 Implicit,
15 Explicit,
16 };
17
18 BackendScope(RendererBackend&, ScopeType = ScopeType::Explicit);
19 ~BackendScope();
20
21 // Returns true when there is currently a BackendScope active in this thread.
22 static bool exists();
23
24private:
25 void activate();
26 void deactivate();
27
28 BackendScope* priorScope;
29 BackendScope* nextScope;
30 RendererBackend& backend;
31 const ScopeType scopeType;
32 bool activated = false;
33};
34
35} // namespace mbgl
36

source code of qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/renderer/backend_scope.hpp