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:
parent
f608e561a2
commit
2cee702ff4
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user