1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-23 20:25:19 +02:00

ubb-la/gui.c (show_buffer): fix calculation of the position offset (dp)

"pos" counts from zero so the middle point is (nibbles-skip)/2 while
the code assumed "pos" was an index into the actual buffer and the
middle point would therefore have been (nibbles+skip)/2
This commit is contained in:
Werner Almesberger 2013-01-31 14:41:10 -03:00
parent 8b69d26fa9
commit 137ed18dc2

View File

@ -300,7 +300,7 @@ static void show_buffer(const uint8_t *buf, int skip, int nibbles,
int d, dp;
xm = (x0+x1) >> 1;
dp = pos-((nibbles+skip) >> 1);
dp = pos-((nibbles-skip) >> 1);
DEBUG("show: %d-%d Sa; %d-%d pix; pos %d dp %d; xm %d xcenter %d\n",
skip, nibbles, x0, x1, pos, dp, xm, XCENTER);
if (zoom < 0) {