summaryrefslogtreecommitdiff
path: root/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-06-18 16:01:53 +0000
committerManolo Gouy <Manolo>2017-06-18 16:01:53 +0000
commit701fa00c7c54a1260f05ef41ee11592059d9f652 (patch)
treee256811b8842ac1376e8b3730c42478162849eb0 /src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
parent2cda5a4fa682372f294a7a8e9e2b90a9fdb15610 (diff)
Advancing HiDPI support for the WIN32 platform - still incomplete.
It's still necessary to compile with -DFLTK_HIDPI_SUPPORT to activate the new HiDPI support. Default builds get the same HiDPI support as in FLTK 1.3 git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12265 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx')
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
index 00bade1b1..41948b83a 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
@@ -146,7 +146,7 @@ void Fl_GDI_Graphics_Driver::translate_all(int x, int y) {
depth = stack_height - 1;
}
GetWindowOrgEx((HDC)gc(), origins+depth);
- SetWindowOrgEx((HDC)gc(), origins[depth].x - x, origins[depth].y - y, NULL);
+ SetWindowOrgEx((HDC)gc(), origins[depth].x - x*scale_, origins[depth].y - y*scale_, NULL);
depth++;
}
@@ -243,24 +243,44 @@ float Fl_GDI_Graphics_Driver::scale() {
/* Rescale region r with factor f and returns the scaled region.
The input region is deleted if keep is false.
- The input region is inflated by 1 unit before rescaling if inflate is true.
+ //The input region is inflated by 1 unit before rescaling if inflate is true.
Region r is returned unchanged if r is null or f is 1.
*/
-HRGN Fl_GDI_Graphics_Driver::scale_region(HRGN r, float f, bool keep, bool inflate) {
+HRGN Fl_GDI_Graphics_Driver::scale_region(HRGN r, float f, Fl_GDI_Graphics_Driver *dr, bool keep/*, bool inflate*/) {
if (r && f != 1) {
DWORD size = GetRegionData(r, 0, NULL);
RGNDATA *pdata = (RGNDATA*)malloc(size);
GetRegionData(r, size, pdata);
if (!keep) DeleteObject(r);
- if (inflate) {
+ /*if (inflate) { // seems no longer useful
RECT *rects = (RECT*)&(pdata->Buffer);
for (DWORD i = 0; i < pdata->rdh.nCount; i++) {
InflateRect(rects+i, 1, 1);
}
+ }*/
+ POINT pt = {0, 0};
+ if (dr && dr->depth >= 1) { // account for both scaling and translation
+ GetWindowOrgEx((HDC)dr->gc(), &pt);
+ pt.x *= (f - 1);
+ pt.y *= (f - 1);
}
- XFORM xform = {f, 0, 0, f, 0, 0};
+ XFORM xform = {f, 0, 0, f, (FLOAT)pt.x , (FLOAT)pt.y};
r = ExtCreateRegion(&xform, size, pdata);
free(pdata);
+
+ if (dr && int(f) != f && f > 1) { // needed for clean checkers demo
+ DWORD size = GetRegionData(r, 0, NULL);
+ RGNDATA *pdata = (RGNDATA*)malloc(size);
+ GetRegionData(r, size, pdata);
+ DeleteObject(r);
+ RECT *rects = (RECT*)&(pdata->Buffer);
+ for (DWORD i = 0; i < pdata->rdh.nCount; i++) {
+ InflateRect(rects+i, 1, 1);
+ }
+ r = ExtCreateRegion(NULL, size, pdata);
+ free(pdata);
+ }
+
}
return r;
}
@@ -268,7 +288,7 @@ HRGN Fl_GDI_Graphics_Driver::scale_region(HRGN r, float f, bool keep, bool infla
Fl_Region Fl_GDI_Graphics_Driver::scale_clip(float f) {
HRGN r = rstack[rstackptr];
- HRGN r2 = scale_region(r, f, true);
+ HRGN r2 = scale_region(r, f, this, true);
return (r == r2 ? NULL : (rstack[rstackptr] = r2, r));
}