summaryrefslogtreecommitdiff
path: root/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index 979cef3d8..89014826f 100644
--- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -94,7 +94,7 @@ char *Fl_Wayland_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n,
{
// write str to a bitmap just big enough
Fl_Image_Surface *surf = new Fl_Image_Surface(w, h);
- Fl_Font f=fl_font();
+ Fl_Font f = fl_font();
Fl_Surface_Device::push_current(surf);
fl_color(FL_BLACK);
fl_rectf(0, 0, w, h);
@@ -104,7 +104,8 @@ char *Fl_Wayland_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n,
// get the R channel only of the bitmap
char *alpha_buf = new char[w*h], *r = alpha_buf, *q;
for (int i = 0; i < h; i++) {
- q = (char*)surf->offscreen()->draw_buffer + i * surf->offscreen()->stride;
+ struct fl_wld_buffer *off = (struct fl_wld_buffer *)surf->offscreen();
+ q = (char*)off->draw_buffer + i * off->stride;
for (int j = 0; j < w; j++) {
*r++ = *q;
q += 4;
@@ -174,7 +175,7 @@ GLContext Fl_Wayland_Gl_Window_Driver::create_gl_context(Fl_Window* window, cons
if (context_list && nContext) shared_ctx = context_list[0];
static const EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
- GLContext ctx = (GLContext)eglCreateContext(egl_display, ((Fl_Wayland_Gl_Choice*)g)->egl_conf, shared_ctx?shared_ctx:EGL_NO_CONTEXT, context_attribs);
+ GLContext ctx = (GLContext)eglCreateContext(egl_display, ((Fl_Wayland_Gl_Choice*)g)->egl_conf, shared_ctx?(EGLContext)shared_ctx:EGL_NO_CONTEXT, context_attribs);
//fprintf(stderr, "eglCreateContext=%p shared_ctx=%p\n", ctx, shared_ctx);
if (ctx)
add_context(ctx);
@@ -183,7 +184,7 @@ GLContext Fl_Wayland_Gl_Window_Driver::create_gl_context(Fl_Window* window, cons
void Fl_Wayland_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context) {
- struct wld_window *win = fl_xid(w);
+ struct wld_window *win = fl_wl_xid(w);
if (!win) return;
Fl_Wayland_Window_Driver *dr = Fl_Wayland_Window_Driver::driver(w);
EGLSurface target_egl_surface = NULL;
@@ -221,7 +222,7 @@ void Fl_Wayland_Gl_Window_Driver::delete_gl_context(GLContext context) {
cached_window = 0;
}
//EGLBoolean b =
- eglDestroyContext(egl_display, context);
+ eglDestroyContext(egl_display, (EGLContext)context);
//fprintf(stderr,"EGL context %p destroyed %s\n", context, b==EGL_TRUE?"successfully":"w/ error");
//b =
eglDestroySurface(egl_display, egl_surface);
@@ -246,7 +247,7 @@ void Fl_Wayland_Gl_Window_Driver::redraw_overlay() {
void Fl_Wayland_Gl_Window_Driver::make_current_before() {
if (!egl_window) {
- struct wld_window *win = fl_xid(pWindow);
+ struct wld_window *win = fl_wl_xid(pWindow);
struct wl_surface *surface = win->wl_surface;
egl_window = wl_egl_window_create(surface, pWindow->pixel_w(), pWindow->pixel_h());
if (egl_window == EGL_NO_SURFACE) {
@@ -270,7 +271,7 @@ void Fl_Wayland_Gl_Window_Driver::make_current_before() {
float Fl_Wayland_Gl_Window_Driver::pixels_per_unit()
{
int ns = Fl_Window_Driver::driver(pWindow)->screen_num();
- int wld_scale = pWindow->shown() ? fl_xid(pWindow)->scale : 1;
+ int wld_scale = pWindow->shown() ? fl_wl_xid(pWindow)->scale : 1;
return wld_scale * Fl::screen_driver()->scale(ns);
}
@@ -360,7 +361,7 @@ static void delayed_flush(Fl_Gl_Window *win) {
void Fl_Wayland_Gl_Window_Driver::resize(int is_a_resize, int W, int H) {
if (!egl_window) return;
- struct wld_window *win = fl_xid(pWindow);
+ struct wld_window *win = fl_wl_xid(pWindow);
float f = Fl::screen_scale(pWindow->screen_num());
W = (W * win->scale) * f;
H = (H * win->scale) * f;
@@ -404,4 +405,7 @@ void Fl_Wayland_Gl_Window_Driver::gl_start() {
glClear(GL_COLOR_BUFFER_BIT);
}
+
+FL_EXPORT EGLContext fl_wl_glcontext(GLContext rc) { return (EGLContext)rc; }
+
#endif // HAVE_GL