From e19bfc0d8ff38672315f6500c441d3a716ff3aee Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 2 Mar 2021 12:11:08 +0100 Subject: Windows platform: accurate drawing area of RGB images with scaled GUI. --- src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/drivers/GDI') diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx index 29fd653b5..103264068 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx @@ -536,25 +536,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); } - bool need_clip = (cx || cy || WP != rgb->w() || HP != rgb->h()); - if (need_clip) { - push_clip(XP, YP, WP, HP); - XP -= cx; YP -= cy; cx = cy = 0; WP = rgb->w(); HP = rgb->h(); - } - int W = WP, H = HP; - cache_size(rgb, W, H); + push_clip(XP, YP, WP, HP); + XP -= cx; YP -= cy; + WP = rgb->w(); HP = rgb->h(); + cache_size(rgb, WP, HP); HDC new_gc = CreateCompatibleDC(gc_); int save = SaveDC(new_gc); SelectObject(new_gc, (HBITMAP)*Fl_Graphics_Driver::id(rgb)); if ( (rgb->d() % 2) == 0 ) { - alpha_blend_(this->floor(XP), this->floor(YP), W, H, new_gc, 0, 0, rgb->data_w(), rgb->data_h()); + alpha_blend_(this->floor(XP), this->floor(YP), WP, HP, new_gc, 0, 0, rgb->data_w(), rgb->data_h()); } else { SetStretchBltMode(gc_, HALFTONE); - StretchBlt(gc_, this->floor(XP), this->floor(YP), W, H, new_gc, 0, 0, rgb->data_w(), rgb->data_h(), SRCCOPY); + StretchBlt(gc_, this->floor(XP), this->floor(YP), WP, HP, new_gc, 0, 0, rgb->data_w(), rgb->data_h(), SRCCOPY); } RestoreDC(new_gc, save); DeleteDC(new_gc); - if (need_clip) pop_clip(); + pop_clip(); } -- cgit v1.2.3