mirror of https://github.com/fltk/fltk
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:
parent
f787a1b4e4
commit
4f29313a80
|
@ -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
|
||||
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) {
|
||||
// Also tell Windows that we are drawing someplace else as well...
|
||||
CombineRgn(R2, R2, R, RGN_OR);
|
||||
|
|
Loading…
Reference in New Issue