diff options
Diffstat (limited to 'src/Fl_Image_Surface.cxx')
| -rw-r--r-- | src/Fl_Image_Surface.cxx | 62 |
1 files changed, 13 insertions, 49 deletions
diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx index 964c5d567..83bc421c3 100644 --- a/src/Fl_Image_Surface.cxx +++ b/src/Fl_Image_Surface.cxx @@ -17,40 +17,13 @@ // #include <FL/Fl_Image_Surface.H> -#include "config_lib.h" - - -#ifdef FL_CFG_GFX_QUARTZ -#include <src/drivers/Quartz/Fl_Quartz_Image_Surface.H> - -#elif defined(FL_CFG_GFX_GDI) -#include <src/drivers/GDI/Fl_GDI_Image_Surface.H> - -#elif defined(USE_SDL) -#include <src/drivers/PicoSDL/Fl_PicoSDL_Image_Surface.H> - -#elif defined(FL_PORTING) || defined(USE_SDL) -# pragma message "FL_PORTING: implement class Fl_Image_Surface::Helper for your platform" - -class Fl_Image_Surface::Helper : public Fl_Widget_Surface { // class model - friend class Fl_Image_Surface; -public: - Fl_Offscreen offscreen; - int width; - int height; - Helper(int w, int h, int high_res) : Fl_Widget_Surface(NULL), width(w), height(h) {} // to implement - ~Helper() {} // to implement - void set_current(){} // to implement - void translate(int x, int y) {} // to implement - void untranslate() {} // to implement - Fl_RGB_Image *image() {} // to implement - void end_current() {} // to implement - int printable_rect(int *w, int *h) {*w = width; *h = height; return 0;} -}; - -#elif defined(FL_CFG_GFX_XLIB) -#include <src/drivers/Xlib/Fl_Xlib_Image_Surface.H> +#if defined(FL_PORTING) +# pragma message "FL_PORTING: implement class Fl_XXX_Image_Surface_Driver for your platform" +Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen) +{ + return NULL; +} #endif @@ -60,26 +33,16 @@ public: which is useful to draw it later on a high resolution display (e.g., retina display). This is implemented for the Mac OS platform only. If \p highres is non-zero, use Fl_Image_Surface::highres_image() to get the image data. + \param pixmap is used internally by FLTK; applications just use its default value. \version 1.3.4 (1.3.3 without the highres parameter) */ -Fl_Image_Surface::Fl_Image_Surface(int w, int h, int high_res) : Fl_Widget_Surface(NULL) { - platform_surface = new Helper(w, h, high_res); +Fl_Image_Surface::Fl_Image_Surface(int w, int h, int high_res, Fl_Offscreen pixmap) : Fl_Widget_Surface(NULL) { + platform_surface = Fl_Image_Surface_Driver::newImageSurfaceDriver(w, h, high_res, pixmap); driver(platform_surface->driver()); } -/** Special constructor that is effective on the Xlib platform only. - */ -Fl_Image_Surface::Fl_Image_Surface(Fl_Offscreen pixmap, int w, int h) : Fl_Widget_Surface(NULL) { -#ifdef FL_CFG_GFX_XLIB - platform_surface = new Helper(pixmap, w, h); -#else - platform_surface = new Helper(w, h, 0); -#endif - driver(platform_surface->driver()); -} -/** The destructor. - */ +/** The destructor. */ Fl_Image_Surface::~Fl_Image_Surface() { delete platform_surface; } void Fl_Image_Surface::origin(int x, int y) {platform_surface->origin(x, y);} @@ -99,6 +62,7 @@ Fl_Offscreen Fl_Image_Surface::offscreen() {return platform_surface->offscreen;} int Fl_Image_Surface::printable_rect(int *w, int *h) {return platform_surface->printable_rect(w, h);} + /** Returns an image made of all drawings sent to the Fl_Image_Surface object. The returned object contains its own copy of the RGB data. The caller is responsible for deleting the image. @@ -115,7 +79,7 @@ Fl_Shared_Image* Fl_Image_Surface::highres_image() { Fl_Shared_Image *s_img = Fl_Shared_Image::get(platform_surface->image()); int width, height; - printable_rect(&width, &height); + platform_surface->printable_rect(&width, &height); s_img->scale(width, height); return s_img; } @@ -133,7 +97,7 @@ Fl_Offscreen Fl_Image_Surface::get_offscreen_before_delete() { static Fl_Image_Surface **offscreen_api_surface = NULL; static int count_offscreens = 0; -static int find_slot(void) { // return an available slot to memorize an Fl_Image_Surface::Helper object +static int find_slot(void) { // return an available slot to memorize an Fl_Image_Surface object static int max = 0; for (int num = 0; num < count_offscreens; num++) { if (!offscreen_api_surface[num]) return num; |
