summaryrefslogtreecommitdiff
path: root/src/drivers/Xlib
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-03-10 06:46:13 +0000
committerManolo Gouy <Manolo>2018-03-10 06:46:13 +0000
commitfd1696d18e8fac4dfec6da537af79cb2d5a4c1a1 (patch)
tree6b355ebab0118b68d5d2f98f72b617b90e3afd72 /src/drivers/Xlib
parentc0cbf0fbde0ac33d3743a6d50bf0fa9f6664a008 (diff)
Fl_Xlib_Graphics_Driver::scale_clip: restrict the computed X11 region to the 16-bit coordinate space.
This member function transforms the current clip region from FLTK units to pixel units multiplying FLTK units by the current value of the scale factor to get pixel units. The current clip region has been, by construction, restricted to the 16-bit coordinate space. But these data can evade this space after multiplication by the scale factor. Thus, it's necessary to enforce the 16-bit space here which is done with Fl_Xlib_Graphics_Driver::XRectangleRegion. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12727 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Xlib')
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
index dfae0c006..568143811 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
@@ -249,15 +249,16 @@ Region Fl_Xlib_Graphics_Driver::scale_clip(float f) {
if (r == 0 || (f == 1 && offset_x_ == 0 && offset_y_ == 0) ) return 0;
int deltaf = f/2;
Region r2 = XCreateRegion();
- XRectangle R;
for (int i = 0; i < r->numRects; i++) {
int x = (r->rects[i].x1 + offset_x_)*f;
int y = (r->rects[i].y1 + offset_y_)*f;
- R.x = x - deltaf + line_delta_;
- R.y = y - deltaf + line_delta_;
- R.width = int((r->rects[i].x2 + offset_x_) * f) - x;
- R.height = int((r->rects[i].y2 + offset_y_) * f) - y;
- XUnionRectWithRegion(&R, r2, r2);
+ int w = int((r->rects[i].x2 + offset_x_) * f) - x;
+ int h = int((r->rects[i].y2 + offset_y_) * f) - y;
+ x += line_delta_ - deltaf;
+ y += line_delta_ - deltaf;
+ Region R = XRectangleRegion(x, y, w, h);
+ XUnionRegion(R, r2, r2);
+ ::XDestroyRegion(R);
}
rstack[rstackptr] = r2;
return r;