1998-03-12 Federico Mena Quintero <federico@nuclecu.unam.mx>

* gmc-chargrid.c (update_region): Added clipping of region bounds.
This commit is contained in:
Miguel de Icaza 1998-03-13 03:02:10 +00:00
parent 6e4e6e029e
commit 1ee3e159aa
2 changed files with 5 additions and 4 deletions

View File

@ -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.

View File

@ -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);