From 1ee3e159aabf0fa34e0e6fce9a33efe255faae42 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Fri, 13 Mar 1998 03:02:10 +0000 Subject: [PATCH] 1998-03-12 Federico Mena Quintero * gmc-chargrid.c (update_region): Added clipping of region bounds. --- gnome/ChangeLog | 1 + gnome/gmc-chargrid.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 76b640999..8d3135b27 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -2,6 +2,7 @@ * gmc-chargrid.c (gmc_char_grid_draw): Someone teach me how to subtract. Fixed a stupid offsetting bug. + (update_region): Added clipping of region bounds. * gmc-chargrid.c: Changed the struct attr with pointers mess with something saner. diff --git a/gnome/gmc-chargrid.c b/gnome/gmc-chargrid.c index 111ee537d..a54032c23 100644 --- a/gnome/gmc-chargrid.c +++ b/gnome/gmc-chargrid.c @@ -327,10 +327,10 @@ update_region (GmcCharGrid *cgrid, int x, int y, int width, int height) if ((width == 0) || (height == 0)) return; - /* sanity checks */ - - g_assert ((x + width) <= cgrid->width); - g_assert ((y + height) <= cgrid->height); + x = MAX (0, x); + y = MAX (0, y); + width = MIN (width, cgrid->width - x); + height = MIN (height, cgrid->height - y); for (i = 0; i < height; i++) update_strip (cgrid, x, y + i, width);