From 2cee702ff4bb7776905f7b64354d5c249404f3a7 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 29 Apr 2011 13:48:01 -0300 Subject: [PATCH] tstimg.c (grill): avoid fencepost errors (pixel at xres/yres) --- ubb-vga/tstimg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ubb-vga/tstimg.c b/ubb-vga/tstimg.c index fc35e25..a5e7330 100644 --- a/ubb-vga/tstimg.c +++ b/ubb-vga/tstimg.c @@ -86,15 +86,15 @@ static void grill(void **f, int ares, int bres, int swap) int n, o; int i, a, b; - n = ares/GRID+1; - o = (ares % GRID)/2; + n = (ares-1)/GRID+1; + o = ((ares-1) % GRID)/2; if (!(n & 1)) { n--; o += GRID/2; } for (i = 0; i != n; i++) { a = o+i*GRID; - for (b = 0; b != bres; b++) + for (b = 0; b != bres-1; b++) if (swap) pixel(f, bres, b, a, WHITE); else