From 4ca9bc95f8b1cf3bf2b3e06c3e0056ea5f10396f Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sat, 27 Aug 2016 15:17:02 +0000 Subject: [PATCH] Fix Fl_Copy_Surface on Windows 10 when the display scaling factor is > 100% git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@11898 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Copy_Surface.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Fl_Copy_Surface.cxx b/src/Fl_Copy_Surface.cxx index 5321d7d33..5c578bf62 100644 --- a/src/Fl_Copy_Surface.cxx +++ b/src/Fl_Copy_Surface.cxx @@ -87,11 +87,14 @@ Fl_Copy_Surface::Fl_Copy_Surface(int w, int h) : Fl_Surface_Device(NULL) int hdots = GetDeviceCaps(hdc, HORZRES); int vmm = GetDeviceCaps(hdc, VERTSIZE); int vdots = GetDeviceCaps(hdc, VERTRES); + int dhr = GetDeviceCaps(hdc, DESKTOPHORZRES); // true number of pixels on display 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 = dhr/float(hdots); - 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 * factorw / scaling); rect.bottom = (LONG)(h * factorh / scaling); gc = CreateEnhMetaFile (NULL, NULL, &rect, NULL); if (gc != NULL) { SetTextAlign(gc, TA_BASELINE|TA_LEFT);