diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2016-01-20 00:11:43 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2016-01-20 00:11:43 +0000 |
| commit | bd78fa1c48641649e033818503af5c8e99330226 (patch) | |
| tree | e56b03e8cb1cd0a6d63a16082eba28a8e0edfc2c /src/fl_rect.cxx | |
| parent | 9872f7405325019ab925b487dd8988cf9882817d (diff) | |
Starting to cut out individual graphics function, so that multiple drivers can coexist (cfg_gfx). Found the missing pixels in the OpenGL gfx driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11012 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_rect.cxx')
| -rw-r--r-- | src/fl_rect.cxx | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index 9c789e54b..eb23a0d92 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -27,6 +27,7 @@ // that minimal update works. #include <config.h> +#include "config_lib.h" #include <FL/Fl.H> #include <FL/Fl_Widget.H> #include <FL/Fl_Printer.H> @@ -546,20 +547,54 @@ void Fl_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2, i #endif } -void Fl_Graphics_Driver::point(int x, int y) { -#if defined(USE_X11) - XDrawPoint(fl_display, fl_window, fl_gc, clip_x(x), clip_x(y)); -#elif defined(WIN32) - SetPixel(fl_gc, x, y, fl_RGB()); -#elif defined(__APPLE_QUARTZ__) + +/* + Matt: I wrote individual methods for every class. They are virtual, so the + correct function is called, depending on the active driver. + + By having individual methods, multiple drivers can co-exist, for example + Quartz, OpenGL, and a printer driver. + + The individual implementations should eventually go into files that are + included into this file, based on the configuration, for example: + + src/cfg_gfx/quartz_rect.cxx + src/cfg_gfx/gdi_rect.cxx + src/cfg_gfx/xlib_rect.cxx + + Porting the graphics system to a new platform then requires to copy one of + these files and implement the virtual functions. point() is the only function + that *must* be implemented when deriving from 'Fl_Minimal_Graphics_Driver" + (which is still to be written) + */ + +#ifdef FL_CFG_GFX_QUARTZ + +void Fl_Quartz_Graphics_Driver::point(int x, int y) { CGContextFillRect(fl_gc, CGRectMake(x - 0.5, y - 0.5, 1, 1) ); -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: implement point" -#else -# error unsupported platform +} + +#endif + + +#ifdef FL_CFG_GFX_GDI + +void Fl_GDI_Graphics_Driver::point(int x, int y) { + SetPixel(fl_gc, x, y, fl_RGB()); +} + #endif + + +#ifdef FL_CFG_GFX_XLIB + +void Fl_Xlib_Graphics_Driver::point(int x, int y) { + XDrawPoint(fl_display, fl_window, fl_gc, clip_x(x), clip_x(y)); } +#endif + + //////////////////////////////////////////////////////////////// #if defined(WIN32) |
