1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-27 17:05:20 +02:00

tstimg.c (grill): avoid fencepost errors (pixel at xres/yres)

This commit is contained in:
Werner Almesberger 2011-04-29 13:48:01 -03:00
parent f608e561a2
commit 2cee702ff4

View File

@ -86,15 +86,15 @@ static void grill(void **f, int ares, int bres, int swap)
int n, o; int n, o;
int i, a, b; int i, a, b;
n = ares/GRID+1; n = (ares-1)/GRID+1;
o = (ares % GRID)/2; o = ((ares-1) % GRID)/2;
if (!(n & 1)) { if (!(n & 1)) {
n--; n--;
o += GRID/2; o += GRID/2;
} }
for (i = 0; i != n; i++) { for (i = 0; i != n; i++) {
a = o+i*GRID; a = o+i*GRID;
for (b = 0; b != bres; b++) for (b = 0; b != bres-1; b++)
if (swap) if (swap)
pixel(f, bres, b, a, WHITE); pixel(f, bres, b, a, WHITE);
else else