From 33d73243b99b3ff585184e819f41ca2205449752 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 11 Nov 2011 21:48:46 -0800 Subject: [PATCH] pspp-sheet-view: Fix visual artifacts for sheet views > 65535 pixels wide. 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 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ui/gui/pspp-sheet-view.c b/src/ui/gui/pspp-sheet-view.c index 1e50c2801a..0b708ab270 100644 --- a/src/ui/gui/pspp-sheet-view.c +++ b/src/ui/gui/pspp-sheet-view.c @@ -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); } } -- 2.30.2