From 12f628514771294102d2aa961373373a95ddab6b Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Thu, 8 Mar 2018 23:09:23 +0000 Subject: Fix X11 clip region outside 16-bit coordinate space. This is the first commit of X11 16-bit coordinate space (clipping) fixes. More to follow... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12722 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx index 10d6f4875..bf1edd3ac 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx @@ -143,11 +143,16 @@ int Fl_Xlib_Graphics_Driver::clip_x (int x) { // Missing X call: (is this the fastest way to init a 1-rectangle region?) // Windows equivalent exists, implemented inline in win32.H + +// Note: if the entire region is outside the 16-bit X coordinate space an empty +// clipping region is returned which means that *nothing* will be visible. + Fl_Region Fl_Xlib_Graphics_Driver::XRectangleRegion(int x, int y, int w, int h) { XRectangle R; - clip_to_short(x, y, w, h, line_width_); + Fl_Region r = XCreateRegion(); // create an empty region + if (clip_to_short(x, y, w, h, line_width_)) // outside X coordinate space + return r; R.x = x; R.y = y; R.width = w; R.height = h; - Fl_Region r = XCreateRegion(); XUnionRectWithRegion(&R, r, r); return r; } -- cgit v1.2.3