summaryrefslogtreecommitdiff
path: root/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-10-22 11:42:20 +0000
committerManolo Gouy <Manolo>2016-10-22 11:42:20 +0000
commitbbfd91977309465464a318e69dfad2bbfbc5df5a (patch)
treecd24598c8f0e1b505d469b08658c0e48fd259ef7 /src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
parent52479a5ef156ec7bf4ed1661bf5fd6ac5f04b98f (diff)
WIN platform: implement Fl_GDI_Graphics_Driver::draw_scaled(Fl_Image *img,int,int,int,int) when img is a Fl_RGB_Image
Implementation uses StretchBlt() when img->d() is 1 or 3 and AlphaBlend() when it is 2 or 4. This should turn useful to draw images on HighDPI displays using the display's true resolution. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12053 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx')
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index 66f51456c..a9ecae8e0 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -541,6 +541,25 @@ int Fl_GDI_Printer_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, i
return 1;
}
+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 = (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);
+ SelectObject(new_gc, (HBITMAP)rgb->id_);
+ if ((img->d() % 2) == 0 & can_do_alpha_blending()) {
+ alpha_blend_(XP, YP, WP, HP, new_gc, 0, 0, rgb->w(), rgb->h());
+ } else {
+ SetStretchBltMode(gc_, HALFTONE);
+ StretchBlt(gc_, XP, YP, WP, HP, new_gc, 0, 0, rgb->w(), rgb->h(), SRCCOPY);
+ }
+ RestoreDC(new_gc, save);
+ DeleteDC(new_gc);
+ return 1;
+}
+
void Fl_GDI_Graphics_Driver::uncache(Fl_RGB_Image*, fl_uintptr_t &id_, fl_uintptr_t &mask_)
{
if (id_) {