summaryrefslogtreecommitdiff
path: root/common/headless_view.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/headless_view.hpp')
-rw-r--r--common/headless_view.hpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/common/headless_view.hpp b/common/headless_view.hpp
index 42f9c46da2..c0baddb884 100644
--- a/common/headless_view.hpp
+++ b/common/headless_view.hpp
@@ -1,51 +1,63 @@
-#ifndef MBGL_COMMON_HEADLESS_CGL
-#define MBGL_COMMON_HEADLESS_CGL
+#ifndef MBGL_COMMON_HEADLESS_VIEW
+#define MBGL_COMMON_HEADLESS_VIEW
#ifdef __APPLE__
#define MBGL_USE_CGL 1
#else
+#define GL_GLEXT_PROTOTYPES
#include <GL/glx.h>
#define MBGL_USE_GLX 1
#endif
#include <mbgl/map/view.hpp>
#include <mbgl/platform/gl.hpp>
-#include <mbgl/util/time.hpp>
+
+#include <memory>
namespace mbgl {
+class HeadlessDisplay;
+
class HeadlessView : public View {
public:
HeadlessView();
+ HeadlessView(std::shared_ptr<HeadlessDisplay> display);
~HeadlessView();
+ void createContext();
+
void resize(uint16_t width, uint16_t height, float pixelRatio);
+ const std::unique_ptr<uint32_t[]> readPixels();
void notify();
void notify_map_change(MapChange change, timestamp delay = 0);
void make_active();
+ void make_inactive();
void swap();
- unsigned int root_fbo();
private:
void clear_buffers();
-
private:
+ std::shared_ptr<HeadlessDisplay> display_;
+ uint16_t width_;
+ uint16_t height_;
+ float pixelRatio_;
+
#if MBGL_USE_CGL
CGLContextObj gl_context;
- GLuint fbo = 0;
- GLuint fbo_depth_stencil = 0;
- GLuint fbo_color = 0;
#endif
#if MBGL_USE_GLX
- GLXContext gl_context = nullptr;
- XVisualInfo *x_info = nullptr;
Display *x_display = nullptr;
- Pixmap x_pixmap = 0;
- GLXPixmap glx_pixmap = 0;
+ GLXFBConfig *fb_configs = nullptr;
+ GLXContext gl_context = 0;
+ GLXPbuffer glx_pbuffer = 0;
#endif
+
+ GLuint fbo = 0;
+ GLuint fbo_depth_stencil = 0;
+ GLuint fbo_color = 0;
};
}