|
|
commit 4f29313a80169d28ac1f898bb2089faa9de3f7e4
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu Dec 3 15:08:44 2020 +0100
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu Dec 3 15:08:59 2020 +0100
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.
src/Fl_win32.cxx | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git src/Fl_win32.cxx src/Fl_win32.cxx
index 0a9f709..555abd1 100644
--- src/Fl_win32.cxx
+++ src/Fl_win32.cxx
@@ -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);
[ Direct Link to Message ] | |
|
| |