From bd4679f8d4fdfe7e8cec72865358370df6e56292 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 3 May 2018 08:37:58 +0000 Subject: Fix fl_overlay_rect() under X11 and Windows when GUI is scaled. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12891 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (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 a675d1620..d93a2df6d 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -503,7 +503,15 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle( int h) // I - Height of area to read { float s = Fl_Surface_Device::surface()->driver()->scale(); - return read_win_rectangle_unscaled(X*s, Y*s, w*s, h*s); + int ws, hs; + if (int(s) == s) { ws = w * s; hs = h * s;} + else { + ws = (w+1)*s-1; + hs = (h+1)*s-1; + if (ws < 1) ws = 1; + if (hs < 1) hs = 1; + } + return read_win_rectangle_unscaled(X*s, Y*s, ws, hs); } Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y, int w, int h) -- cgit v1.2.3