From 428008c27612583dfa5951cbb28de716a48976fe Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 1 May 2011 12:45:29 +0000 Subject: Fixed drawing artifacts when scrolling round boxes (FL_ROUND_UP_BOX and FL_ROUND_DOWN_BOX) on Linux (STR #2615). This was done by (a) setting the line width in the box drawing function (was undefined, maybe 0) (b) taking care of zero and negative line width in X11 clipping functions. Both solutions would have solved the particular problem individually. Additionally made local helper function fl_arc_i() in src/fl_round_box.cxx static to avoid name clashes. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8630 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_rect.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/fl_rect.cxx') diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index da2ef4154..f893d8b22 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -82,6 +82,10 @@ extern float fl_quartz_line_width_; In this example case, no clipping would be done, because X can handle it and clip unneeded pixels. + + Note that we must also take care of the case where fl_line_width_ + is zero (maybe unitialized). If this is the case, we assume a line + width of 1. Todo: Arbitrary line drawings (e.g. polygons) and clip regions are not yet done. @@ -120,8 +124,9 @@ extern float fl_quartz_line_width_; static int clip_to_short(int &x, int &y, int &w, int &h) { - int kmin = -fl_line_width_; - int kmax = SHRT_MAX - fl_line_width_; + int lw = (fl_line_width_ > 0) ? fl_line_width_ : 1; + int kmin = -lw; + int kmax = SHRT_MAX - lw; if (w <= 0 || h <= 0) return 1; // (a) if (x+w < kmin || y+h < kmin) return 1; // (b) @@ -145,8 +150,9 @@ static int clip_to_short(int &x, int &y, int &w, int &h) { */ static int clip_x (int x) { - int kmin = -fl_line_width_; - int kmax = SHRT_MAX - fl_line_width_; + int lw = (fl_line_width_ > 0) ? fl_line_width_ : 1; + int kmin = -lw; + int kmax = SHRT_MAX - lw; if (x < kmin) x = kmin; -- cgit v1.2.3