From 137ed18dc20fc217b22172072dd643ca0a7c121f Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Thu, 31 Jan 2013 14:41:10 -0300 Subject: [PATCH] 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 --- ubb-la/gui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubb-la/gui.c b/ubb-la/gui.c index 1f90294..117a30b 100644 --- a/ubb-la/gui.c +++ b/ubb-la/gui.c @@ -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) {