|
commit 95c851fda10d5305082619dc977f63aa5df0929b
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Tue Aug 30 07:58:16 2022 +0200
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Tue Aug 30 07:58:16 2022 +0200
Set Fl_Graphics_Driver::set_color(Fl_Color, unsigned) used by macOS, Wayland and display-cairo.
src/Fl_Graphics_Driver.cxx | 6 +++++-
src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H | 1 -
src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx | 7 -------
src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H | 3 +--
src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx | 8 --------
5 files changed, 6 insertions(+), 19 deletions(-)
diff --git src/Fl_Graphics_Driver.cxx src/Fl_Graphics_Driver.cxx
index 76575d1..5ba7853 100644
--- src/Fl_Graphics_Driver.cxx
+++ src/Fl_Graphics_Driver.cxx
@@ -38,6 +38,8 @@ const Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m0 = {1, 0, 0, 1, 0, 0};
/** Used by the Windows platform to print Fl_Pixmap objects. */
unsigned Fl_Graphics_Driver::need_pixmap_bg_color = 0;
+extern unsigned fl_cmap[256]; // defined in fl_color.cxx
+
/** Constructor */
Fl_Graphics_Driver::Fl_Graphics_Driver()
{
@@ -135,7 +137,9 @@ void Fl_Graphics_Driver::global_gc()
/** see Fl::set_color(Fl_Color, unsigned) */
void Fl_Graphics_Driver::set_color(Fl_Color i, unsigned c)
{
- // nothing to do, reimplement in driver if needed
+ if (fl_cmap[i] != c) {
+ fl_cmap[i] = c;
+ }
}
diff --git src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
index b073d63..945ba4a 100644
--- src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
+++ src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
@@ -116,7 +116,6 @@ protected:
void pie(int x, int y, int w, int h, double a1, double a2);
void line_style(int style, int width=0, char* dashes=0);
void color(Fl_Color c);
- void set_color(Fl_Color i, unsigned int c);
Fl_Color color() { return color_; }
void color(uchar r, uchar g, uchar b);
void draw(const char *str, int n, int x, int y);
diff --git src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx
index 8d826e8..a4cb37d 100644
--- src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx
+++ src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx
@@ -63,10 +63,3 @@ void Fl_Quartz_Graphics_Driver::color(uchar r, uchar g, uchar b) {
CGContextSetRGBFillColor(gc_, fr, fg, fb, 1.0f);
CGContextSetRGBStrokeColor(gc_, fr, fg, fb, 1.0f);
}
-
-// FIXME: this function should not be here! It's not part of the driver.
-void Fl_Quartz_Graphics_Driver::set_color(Fl_Color i, unsigned c) {
- if (fl_cmap[i] != c) {
- fl_cmap[i] = c;
- }
-}
diff --git src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
index cb8d128..9b2edba 100644
--- src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
+++ src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H
@@ -75,8 +75,7 @@ public:
Fl_Wayland_Graphics_Driver();
static const uint32_t wld_format;
void set_buffer(struct fl_wld_buffer *buffer, float scale = 0);
- void set_color(Fl_Color i, unsigned c);
- void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc, int srcx, int srcy);
+ virtual void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc, int srcx, int srcy);
static struct fl_wld_buffer *create_shm_buffer(int width, int height);
static void buffer_release(struct wld_window *window);
static void buffer_commit(struct wld_window *window, const struct wl_callback_listener*);
diff --git src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
index 986d25d..031c44e 100644
--- src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
+++ src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx
@@ -28,7 +28,6 @@
#include <errno.h>
#include <string.h> // for strerror()
-extern unsigned fl_cmap[256]; // defined in fl_color.cxx
extern "C" {
int os_create_anonymous_file(off_t); // in libdecor
@@ -142,13 +141,6 @@ void Fl_Wayland_Graphics_Driver::set_buffer(struct fl_wld_buffer *buffer, float
}
-void Fl_Wayland_Graphics_Driver::set_color(Fl_Color i, unsigned c) {
- if (fl_cmap[i] != c) {
- fl_cmap[i] = c;
- }
-}
-
-
void Fl_Wayland_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen src, int srcx, int srcy) {
// draw portion srcx,srcy,w,h of osrc to position x,y (top-left) of the graphics driver's surface
struct fl_wld_buffer *osrc = (struct fl_wld_buffer *)src;
[ Direct Link to Message ] | |