Browse Source

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
pull/1/head
Matthias Melcher 9 years ago
parent
commit
c9d3eabf4e
  1. 2
      FL/Fl_Graphics_Driver.H
  2. 22
      src/Fl_Graphics_Driver.cxx
  3. 2
      src/drivers/GDI/Fl_GDI_Graphics_Driver.H
  4. 4
      src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx
  5. 1
      src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx
  6. 1
      src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx
  7. 1
      src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
  8. 2
      src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx
  9. 2
      src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
  10. 4
      src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx
  11. 14
      src/fl_color.cxx

2
FL/Fl_Graphics_Driver.H

@ -178,6 +178,8 @@ public: @@ -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

22
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 @@ -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$".
//

2
src/drivers/GDI/Fl_GDI_Graphics_Driver.H

@ -127,6 +127,8 @@ protected: @@ -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:

4
src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx

@ -185,12 +185,12 @@ CREATE_BRUSH: @@ -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;

1
src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx

@ -471,7 +471,6 @@ int Fl::dnd() { return 0; } @@ -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; }

1
src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx

@ -142,7 +142,6 @@ double Fl_PicoSDL_Screen_Driver::wait(double time_to_wait) @@ -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; }

1
src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H

@ -110,6 +110,7 @@ protected: @@ -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

2
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) { @@ -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;
}

2
src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H

@ -125,6 +125,8 @@ protected: @@ -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);

4
src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx

@ -308,7 +308,7 @@ ulong fl_xpixel(Fl_Color i) { @@ -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) { @@ -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

14
src/fl_color.cxx

@ -25,6 +25,7 @@ @@ -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) { @@ -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.

Loading…
Cancel
Save