From fd2da982b625109efe50a0c9351bf6dd5abc8aae Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sat, 27 Aug 2016 15:54:51 +0000 Subject: Fix Fl_Copy_Surface under Windows 10 when the desktop scaling factor value is > 100 % git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11899 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/drivers/GDI') diff --git a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx index 1a7a88b27..2d0ab4760 100644 --- a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx @@ -22,6 +22,7 @@ #include #include #include "Fl_GDI_Graphics_Driver.H" +#include "../WinAPI/Fl_WinAPI_Screen_Driver.H" #include class Fl_GDI_Copy_Surface_Driver : public Fl_Copy_Surface_Driver { @@ -58,8 +59,10 @@ Fl_GDI_Copy_Surface_Driver::Fl_GDI_Copy_Surface_Driver(int w, int h) : Fl_Copy_S ReleaseDC(NULL, hdc); float factorw = (100.f * hmm) / hdots; float factorh = (100.f * vmm) / vdots; + // Global display scaling factor: 1, 1.25, 1.5, 1.75, etc... + float scaling = Fl_WinAPI_Screen_Driver::desktop_scaling_factor(); - RECT rect; rect.left = 0; rect.top = 0; rect.right = (LONG)(w * factorw); rect.bottom = (LONG)(h * factorh); + RECT rect; rect.left = 0; rect.top = 0; rect.right = (LONG)((w/scaling) * factorw); rect.bottom = (LONG)((h/scaling) * factorh); gc = CreateEnhMetaFile (NULL, NULL, &rect, NULL); if (gc != NULL) { SetTextAlign(gc, TA_BASELINE|TA_LEFT); -- cgit v1.2.3