From caaa11a96f8448bd78cb270e4861f5e9ff1a6763 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 13 Apr 2023 10:02:40 +0200 Subject: Standardize API to "graphics context" across platforms Rename fl_wl_cairo() to fl_wl_gc() Add function cairo_t* fl_cairo_gc() under OPTION_USE_CAIRO --- src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx | 4 ++++ src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H | 2 -- src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx | 9 --------- src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx index d673c3dfa..3ad9a0d88 100644 --- a/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx +++ b/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx @@ -62,3 +62,7 @@ void Fl_X11_Cairo_Graphics_Driver::gc(void *value) { void *Fl_X11_Cairo_Graphics_Driver::gc() { return gc_; } + +extern FL_EXPORT cairo_t* fl_cairo_gc() { + return ((Fl_Cairo_Graphics_Driver*)fl_graphics_driver)->cr(); +} diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H index 5e3b13f8b..b9dbb78be 100644 --- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H @@ -80,8 +80,6 @@ public: static void buffer_release(struct wld_window *window); static void buffer_commit(struct wld_window *window, struct flCairoRegion *r = NULL); static void cairo_init(struct fl_wld_buffer *buffer, int width, int height, int stride, cairo_format_t format); - void *gc() FL_OVERRIDE; - void gc(void *gc) FL_OVERRIDE; }; #endif // FL_WAYLAND_GRAPHICS_DRIVER_H diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx index d9eedb317..9b26f8439 100644 --- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx @@ -208,12 +208,3 @@ void Fl_Wayland_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_O cairo_surface_destroy(surf); cairo_restore(cairo_); } - - -void Fl_Wayland_Graphics_Driver::gc(void *off) {} // equivalent is done by set_buffer() - - -void *Fl_Wayland_Graphics_Driver::gc() { - return buffer_; -} - diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index 37d6e4842..e65229624 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -1817,7 +1817,7 @@ FL_EXPORT struct wl_surface *fl_wl_surface(struct wld_window *xid) { } -cairo_t *fl_wl_cairo() { +cairo_t *fl_wl_gc() { return ((Fl_Cairo_Graphics_Driver*)fl_graphics_driver)->cr(); } -- cgit v1.2.3