summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-10-30 07:26:13 +0000
committerManolo Gouy <Manolo>2016-10-30 07:26:13 +0000
commit3ae2b1d74e35a4ac0d80b35e3eaa23088ccffeb4 (patch)
tree1a86ed98ee2cd762777d190f6e200403a006596b /src
parent2c043fb5b31839d7f7430cb410e175d2945acbe3 (diff)
Add virtual Fl_RGB_Image* Fl_Image::as_rgb_image() to detect whether an Fl_Image is derived from Fl_RGB_Image
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12061 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Shared_Image.cxx2
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/Fl_Shared_Image.cxx b/src/Fl_Shared_Image.cxx
index 216387aa7..f94d28f11 100644
--- a/src/Fl_Shared_Image.cxx
+++ b/src/Fl_Shared_Image.cxx
@@ -378,7 +378,7 @@ void Fl_Graphics_Driver::draw(Fl_Shared_Image *shared, int X, int Y) {
return;
}
// don't call Fl_Graphics_Driver::draw_scaled(Fl_Image*,...) for an enlarged Fl_Bitmap or Fl_Pixmap
- if ((shared->d() != 0 && shared->count() < 2) || (shared->w() <= shared->image_->w() && shared->h() <= shared->image_->h())) {
+ if (shared->as_rgb_image() || (shared->w() <= shared->image_->w() && shared->h() <= shared->image_->h())) {
int done = fl_graphics_driver->draw_scaled(shared->image_, X, Y, shared->w(), shared->h());
if (done) return;
}
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index a9ecae8e0..cbd6f591a 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -542,9 +542,9 @@ int Fl_GDI_Printer_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, i
}
int Fl_GDI_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP) {
- if (img->d() == 0 || img->count() >= 2) return 0; // for bitmaps and pixmaps
+ Fl_RGB_Image *rgb = img->as_rgb_image();
+ if (!rgb || !rgb->array) return 0; // for bitmaps and pixmaps
- Fl_RGB_Image *rgb = (Fl_RGB_Image*)img;
if (!rgb->id_) rgb->id_ = (fl_uintptr_t)build_id(rgb, (void**)&(rgb->mask_));
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);