Windows scaling: fix redraw after partial expose events.

Under XP (at least), WM_PAINT events occur where information of where to redraw
is mostly given by the system, in the window's update region. When the GUI is scaled,
that information must be un-scaled and then added to Fl_X::i(window)->region, for the
adequate part of the window to be painted.
This commit is contained in:
ManoloFLTK 2020-12-03 15:08:44 +01:00
parent f787a1b4e4
commit 4f29313a80
1 changed files with 14 additions and 0 deletions

View File

@ -1252,6 +1252,20 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
// convert i->region in FLTK units to R2 in drawing units // convert i->region in FLTK units to R2 in drawing units
R2 = Fl_GDI_Graphics_Driver::scale_region(i->region, scale, NULL); R2 = Fl_GDI_Graphics_Driver::scale_region(i->region, scale, NULL);
RECT r_box;
if (scale != 1 && GetRgnBox(R, &r_box) != NULLREGION) {
// add de-scaled update region to i->region in FLTK units
r_box.left /= scale;
r_box.right /= scale;
r_box.top /= scale;
r_box.bottom /= scale;
Fl_Region R3 = CreateRectRgn(r_box.left, r_box.top, r_box.right + 1, r_box.bottom + 1);
if (!i->region) i->region = R3;
else {
CombineRgn(i->region, i->region, R3, RGN_OR);
DeleteObject(R3);
}
}
if (R2) { if (R2) {
// Also tell Windows that we are drawing someplace else as well... // Also tell Windows that we are drawing someplace else as well...
CombineRgn(R2, R2, R, RGN_OR); CombineRgn(R2, R2, R, RGN_OR);