From bef46b5cb82464713a117b9bdb920735d1b7de37 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:52:36 +0100 Subject: Improve precision of GUI scaling for Windows platform. --- src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx') diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx index 7c57d08f2..eb437b965 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -20,7 +20,7 @@ #include "../GDI/Fl_Font.H" #include #include -#include +#include "../GDI/Fl_GDI_Graphics_Driver.H" #include #include #include @@ -499,14 +499,14 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle( { float s = Fl_Surface_Device::surface()->driver()->scale(); int ws, hs; - if (int(s) == s) { ws = int(w * s); hs = int(h * s);} + if (int(s) == s) { ws = w * int(s); hs = h * int(s);} else { - ws = int((w+1) * s); // approximates what Fl_Graphics_Driver::cache_size() does - hs = int((h+1) * s); + ws = Fl_GDI_Graphics_Driver::floor(w+1, s); // approximates what Fl_Graphics_Driver::cache_size() does + hs = Fl_GDI_Graphics_Driver::floor(h+1, s); if (ws < 1) ws = 1; if (hs < 1) hs = 1; } - return read_win_rectangle_unscaled(int(X*s), int(Y*s), ws, hs, win); + return read_win_rectangle_unscaled(Fl_GDI_Graphics_Driver::floor(X, s), Fl_GDI_Graphics_Driver::floor(Y, s), ws, hs, win); } Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y, int w, int h, Fl_Window *win) -- cgit v1.2.3