summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView+OpenGL.h
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-05-22 12:12:01 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-05-29 18:27:42 +0200
commit9eb43a587b264524bf9d43d8a578859b63ef2593 (patch)
tree3e47753d30765cc0bd1b3eb146c7af06efc18e15 /platform/ios/src/MGLMapView+OpenGL.h
parent05e194614fff1527f812c73aa0f28d4205908013 (diff)
downloadqtlocation-mapboxgl-9eb43a587b264524bf9d43d8a578859b63ef2593.tar.gz
[ios,macos] refactor MGLMapViewImpl
Diffstat (limited to 'platform/ios/src/MGLMapView+OpenGL.h')
-rw-r--r--platform/ios/src/MGLMapView+OpenGL.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/platform/ios/src/MGLMapView+OpenGL.h b/platform/ios/src/MGLMapView+OpenGL.h
new file mode 100644
index 0000000000..12edb13113
--- /dev/null
+++ b/platform/ios/src/MGLMapView+OpenGL.h
@@ -0,0 +1,59 @@
+#import "MGLMapView+Impl.h"
+#import "MGLMapView_Private.h"
+
+#include <mbgl/gfx/renderable.hpp>
+#include <mbgl/gl/renderer_backend.hpp>
+
+@class MGLMapViewImplDelegate;
+
+/// Adapter responsible for bridging calls from mbgl to MGLMapView and Cocoa.
+class MGLMapViewOpenGLImpl final : public MGLMapViewImpl,
+ public mbgl::gl::RendererBackend,
+ public mbgl::gfx::Renderable {
+public:
+ MGLMapViewOpenGLImpl(MGLMapView*);
+ ~MGLMapViewOpenGLImpl() override;
+
+public:
+ void restoreFramebufferBinding();
+
+#ifdef MGL_RECREATE_GL_IN_AN_EMERGENCY
+private:
+ void emergencyRecreateGL();
+#endif
+
+ // Implementation of mbgl::gfx::RendererBackend
+public:
+ mbgl::gfx::Renderable& getDefaultRenderable() override {
+ return *this;
+ }
+
+private:
+ void activate() override;
+ void deactivate() override;
+ // End implementation of mbgl::gfx::RendererBackend
+
+ // Implementation of mbgl::gl::RendererBackend
+public:
+ void updateAssumedState() override;
+
+private:
+ mbgl::gl::ProcAddress getExtensionFunctionPointer(const char* name) override;
+ // End implementation of mbgl::gl::Rendererbackend
+
+ // Implementation of MGLMapViewImpl
+public:
+ mbgl::gfx::RendererBackend& getRendererBackend() override {
+ return *this;
+ }
+
+ EAGLContext* getEAGLContext() override;
+ void setOpaque(bool) override;
+ void display() override;
+ void setPresentsWithTransaction(bool) override;
+ void createView() override;
+ UIView* getView() override;
+ void deleteView() override;
+ UIImage* snapshot() override;
+ // End implementation of MGLMapViewImpl
+};