pspp-sheet-view: Fix visual artifacts for sheet views > 65535 pixels wide.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 12 Nov 2011 05:48:46 +0000 (21:48 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 25 Apr 2012 05:41:41 +0000 (22:41 -0700)
gdk_draw_line() draws lines by passing the coordinates to XDrawLine(),
which in turn casts the coordinates to "signed int" as it formats them for
the X Protocol.  Thus, large coordinate values wrap around and cause odd
visual artifacts.

This fixes the problem by only calling gdk_draw_line() with coordinate
values that should actually be visible.

src/ui/gui/pspp-sheet-view.c

index 1e50c2801a62c41dfcb1fe9166d6e81b35114ded..0b708ab2709a6237323c901b65509d9165de9b7d 100644 (file)
@@ -3482,10 +3482,12 @@ pspp_sheet_view_draw_grid_lines (PsppSheetView    *tree_view,
 
       current_x += column->width;
 
-      gdk_draw_line (event->window,
-                    tree_view->priv->grid_line_gc,
-                    current_x - 1, 0,
-                    current_x - 1, height);
+      if (current_x - 1 >= event->area.x
+          && current_x - 1 < event->area.x + event->area.width)
+        gdk_draw_line (event->window,
+                       tree_view->priv->grid_line_gc,
+                       current_x - 1, 0,
+                       current_x - 1, height);
     }
 }