summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2020-11-13 10:02:33 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2020-11-13 10:02:43 +0100
commitc227edef39df37077efe979a1f7ab1a397487363 (patch)
tree5548f6765a34a81a9986828b3988e5ad3ba0aea0
parenta4bacf83c44cdad8161af80f55706a5326dd0c0a (diff)
Fix for issue #155 - continued
This fix takes care of the Windows platform.
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index 6bc9ad82d..246f98c81 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -535,18 +535,22 @@ void Fl_GDI_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP, int WP,
if (!*Fl_Graphics_Driver::id(rgb)) {
cache(rgb);
}
- float scaleW = float(rgb->data_w())/rgb->w();
- float scaleH = float(rgb->data_h())/rgb->h();
int W = WP, H = HP;
cache_size(rgb, W, H);
+ int Wfull = rgb->w(), Hfull = rgb->h();
+ cache_size(rgb, Wfull, Hfull);
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
SelectObject(new_gc, (HBITMAP)*Fl_Graphics_Driver::id(rgb));
+ Wfull = W*(rgb->data_w()/float(Wfull)); Hfull = H*(rgb->data_h()/float(Hfull));
+ cx *= scale(); cy *= scale();
+ if (cx+Wfull > rgb->data_w()) Wfull = rgb->data_w()-cx;
+ if (cy+Hfull > rgb->data_h()) Hfull = rgb->data_h()-cy;
if ( (rgb->d() % 2) == 0 ) {
- alpha_blend_(XP*scale(), YP*scale(), W, H, new_gc, cx*scaleW, cy*scaleH, WP*scaleW, HP*scaleH);
+ alpha_blend_(XP*scale(), YP*scale(), W, H, new_gc, cx, cy, Wfull, Hfull);
} else {
SetStretchBltMode(gc_, HALFTONE);
- StretchBlt(gc_, XP*scale(), YP*scale(), W, H, new_gc, cx*scaleW, cy*scaleH, WP*scaleW, HP*scaleH, SRCCOPY);
+ StretchBlt(gc_, XP*scale(), YP*scale(), W, H, new_gc, cx, cy, Wfull, Hfull, SRCCOPY);
}
RestoreDC(new_gc, save);
DeleteDC(new_gc);