From eae09e7fa09c6a00988653ed67fe0d82f1861bff Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 30 Aug 2017 15:49:58 +0000 Subject: Create virtual Fl_Image::draw_scaled_(int X, int Y, int W, int H) and its implementations for image classes. This allows to use the virtual function mechanism to adapt scaled image drawing both to the image type and the graphics driver type. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12410 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Image.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Fl_Image.cxx') diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index 4b074be4a..a622f7d9e 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -578,6 +578,17 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) { m->label(_FL_IMAGE_LABEL, (const char*)this); } +int Fl_RGB_Image::draw_scaled_(int X, int Y, int W, int H) { + return fl_graphics_driver->draw_scaled(this, X, Y, W, H); +} + +// Draws the image scaled to W and H, and returns 1, +// or returns 0 if scaled drawing is not implemented for this image. +// Image classes can re-implement this function for specific image types. +int Fl_Image::draw_scaled_(int X, int Y, int W, int H) { + return 0; +} + // // End of "$Id$". // -- cgit v1.2.3