diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2016-04-17 15:01:20 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2016-04-17 15:01:20 +0000 |
| commit | c9d3eabf4e201384a930707fbe1b8a01771f5e3d (patch) | |
| tree | fc9c2a47341ad484ebe787a8cf6524ac8b62ceaf | |
| parent | 9ae4a99081237f94d47a480d41313dc65737bd98 (diff) | |
virtualized Fl::set_color and free_color.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11642 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_Graphics_Driver.H | 2 | ||||
| -rw-r--r-- | src/Fl_Graphics_Driver.cxx | 22 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx | 4 | ||||
| -rw-r--r-- | src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx | 1 | ||||
| -rw-r--r-- | src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx | 1 | ||||
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx | 4 | ||||
| -rw-r--r-- | src/fl_color.cxx | 14 |
11 files changed, 45 insertions, 10 deletions
diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H index 90af5f134..08ef5694c 100644 --- a/FL/Fl_Graphics_Driver.H +++ b/FL/Fl_Graphics_Driver.H @@ -178,6 +178,8 @@ public: virtual void line_style(int style, int width=0, char* dashes=0) = 0; // --- implementation is in src/fl_color.cxx which includes src/cfg_gfx/xxx_color.cxx virtual void color(Fl_Color c) { color_ = c; } + virtual void set_color(Fl_Color i, unsigned int c); + virtual void free_color(Fl_Color i, int overlay); virtual Fl_Color color() { return color_; } virtual void color(uchar r, uchar g, uchar b) = 0; // --- implementation is in src/fl_font.cxx which includes src/drivers/xxx/Fl_xxx_Graphics_Driver_font.cxx diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index 61ff76cfd..72f52427f 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -69,21 +69,37 @@ void Fl_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen delete[] img; } + void Fl_Graphics_Driver::set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win) { - // nothing to do + // nothing to do, reimplement in driver if needed } + void Fl_Graphics_Driver::reset_spot() { - // nothing to do + // nothing to do, reimplement in driver if needed } + void Fl_Graphics_Driver::global_gc() { - // nothing to do + // nothing to do, reimplement in driver if needed +} + + +void Fl_Graphics_Driver::set_color(Fl_Color i, unsigned int c) +{ + // nothing to do, reimplement in driver if needed +} + + +void Fl_Graphics_Driver::free_color(Fl_Color i, int overlay) +{ + // nothing to do, reimplement in driver if needed } + // // End of "$Id$". // diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index 9cd79ebaa..fa5b517e3 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -127,6 +127,8 @@ protected: void color(Fl_Color c); Fl_Color color() { return color_; } void color(uchar r, uchar g, uchar b); + void set_color(Fl_Color i, unsigned int c); + void free_color(Fl_Color i, int overlay); void set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win); void reset_spot(); protected: diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx index c32bbd8cb..a985250ed 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx @@ -185,12 +185,12 @@ CREATE_BRUSH: return brushes[i].brush; } -void Fl::free_color(Fl_Color i, int overlay) { +void Fl_GDI_Graphics_Driver::free_color(Fl_Color i, int overlay) { if (overlay) return; // do something about GL overlay? clear_xmap(fl_xmap[i]); } -void Fl::set_color(Fl_Color i, unsigned c) { +void Fl_GDI_Graphics_Driver::set_color(Fl_Color i, unsigned c) { if (fl_cmap[i] != c) { clear_xmap(fl_xmap[i]); fl_cmap[i] = c; diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx index 94372136f..76cfb395a 100644 --- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx @@ -471,7 +471,6 @@ int Fl::dnd() { return 0; } void Fl::copy(char const*, int, int, char const*) { } void Fl::paste(Fl_Widget&, int, char const*) { } void Fl::get_mouse(int&, int&) { } -void Fl::set_color(Fl_Color, unsigned int) { } int Fl_X::set_cursor(Fl_Cursor) { return 0; } int Fl_X::set_cursor(Fl_RGB_Image const*, int, int) { return 0; } diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx index 7c7f83fa6..f4cd70926 100644 --- a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx +++ b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx @@ -142,7 +142,6 @@ double Fl_PicoSDL_Screen_Driver::wait(double time_to_wait) #include <FL/Fl_Double_Window.H> #include <FL/Fl_Graphics_Driver.H> -void Fl::set_color(Fl_Color, unsigned int) { } int Fl_X::set_cursor(Fl_Cursor) { return 0; } int Fl_X::set_cursor(Fl_RGB_Image const*, int, int) { return 0; } diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H index 39eaec6cb..30cb8d984 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H @@ -110,6 +110,7 @@ protected: void line_style(int style, int width=0, char* dashes=0); // --- implementation is in src/fl_color.cxx which includes src/cfg_gfx/xxx_color.cxx 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); // --- implementation is in src/fl_font.cxx which includes src/cfg_gfx/xxx_font.cxx diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx index f9dc9e484..25743f257 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx @@ -72,7 +72,7 @@ void Fl_Quartz_Graphics_Driver::color(uchar r, uchar g, uchar b) { } // FIXME: this function should not be here! It's not part of the driver. -void Fl::set_color(Fl_Color i, unsigned c) { +void Fl_Quartz_Graphics_Driver::set_color(Fl_Color i, unsigned c) { if (fl_cmap[i] != c) { fl_cmap[i] = c; } diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H index d207ae16a..1e7bd43d8 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H @@ -125,6 +125,8 @@ protected: void line_style(int style, int width=0, char* dashes=0); // --- implementation is in src/fl_color.cxx which includes src/cfg_gfx/xxx_color.cxx void color(Fl_Color c); + void set_color(Fl_Color i, unsigned int c); + void free_color(Fl_Color i, int overlay); Fl_Color color() { return color_; } void color(uchar r, uchar g, uchar b); virtual float scale_font_for_PostScript(Fl_Font_Descriptor *desc, int s); diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx index 5f241423b..4f8f7961f 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx @@ -308,7 +308,7 @@ ulong fl_xpixel(Fl_Color i) { \param[in] i color index \param[in] overlay 0 for normal, 1 for overlay color */ -void Fl::free_color(Fl_Color i, int overlay) { +void Fl_Xlib_Graphics_Driver::free_color(Fl_Color i, int overlay) { # if HAVE_OVERLAY # else if (overlay) return; @@ -332,7 +332,7 @@ void Fl::free_color(Fl_Color i, int overlay) { \param[in] i color index \param[in] c color */ -void Fl::set_color(Fl_Color i, unsigned c) { +void Fl_Xlib_Graphics_Driver::set_color(Fl_Color i, unsigned c) { if (fl_cmap[i] != c) { free_color(i,0); # if HAVE_OVERLAY diff --git a/src/fl_color.cxx b/src/fl_color.cxx index c3021e7ea..3c7dece44 100644 --- a/src/fl_color.cxx +++ b/src/fl_color.cxx @@ -25,6 +25,7 @@ #include <FL/Fl.H> #include <FL/Fl_Device.H> +#include <FL/Fl_Graphics_Driver.H> #include <FL/Fl.H> // fl_cmap needs to be defined globally (here) and is used in the device @@ -65,6 +66,19 @@ void Fl::set_color(Fl_Color i, uchar red, uchar green, uchar blue) { ((unsigned)red<<24)+((unsigned)green<<16)+((unsigned)blue<<8)); } + +void Fl::set_color(Fl_Color i, unsigned int c) +{ + fl_graphics_driver->set_color(i, c); +} + + +void Fl::free_color(Fl_Color i, int overlay) +{ + fl_graphics_driver->free_color(i, overlay); +} + + /** Returns the RGB value(s) for the given FLTK color index. |
