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
This commit is contained in:
Manolo Gouy 2016-08-27 15:17:02 +00:00
parent 57e48378d7
commit 4ca9bc95f8

View File

@ -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);