1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-07-01 02:44:32 +03: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 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