|
commit c227edef39df37077efe979a1f7ab1a397487363
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri Nov 13 10:02:33 2020 +0100
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri Nov 13 10:02:43 2020 +0100
Fix for issue #155 - continued
This fix takes care of the Windows platform.
src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index 6bc9ad8..246f98c 100644
--- src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ 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);
[ Direct Link to Message ] | |