From 448afbbea5b81ac75e1083c2c0f09ea294621e9b Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Sun, 16 Dec 2012 05:19:18 +0000 Subject: [PATCH] fixed bugs related to borg widths which are not a multiple of 8 --- animations/fpmath_patterns.c | 4 ++-- simulator/main.c | 2 +- simulator/winmain.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/animations/fpmath_patterns.c b/animations/fpmath_patterns.c index 0de4142..2b05464 100644 --- a/animations/fpmath_patterns.c +++ b/animations/fpmath_patterns.c @@ -448,7 +448,7 @@ static unsigned char fixAnimPlasma(unsigned char const x, fixp_t const t, void *const r) { - assert(x < NUM_COLS); + assert(x < (LINEBYTES * 8)); assert(y < NUM_ROWS); // scaling factor @@ -524,7 +524,7 @@ static unsigned char fixAnimPsychedelic(unsigned char const x, fixp_t const t, void *const r) { - assert(x < NUM_COLS); + assert(x < (LINEBYTES * 8)); assert(y < NUM_ROWS); fixp_psychedelic_t *p = (fixp_psychedelic_t *)r; diff --git a/simulator/main.c b/simulator/main.c index 12f63d8..db499f7 100644 --- a/simulator/main.c +++ b/simulator/main.c @@ -28,7 +28,7 @@ #include "trackball.h" /** Number of bytes per row. */ -#define LINEBYTES ((NUM_COLS + 1) / 8) +#define LINEBYTES (((NUM_COLS - 1) / 8) + 1) /** Fake port for simulating joystick input. */ volatile unsigned char fakeport; diff --git a/simulator/winmain.c b/simulator/winmain.c index dd0c054..e831912 100644 --- a/simulator/winmain.c +++ b/simulator/winmain.c @@ -35,7 +35,7 @@ #include "../display_loop.h" /** Number of bytes per row. */ -#define LINEBYTES ((NUM_COLS + 1) / 8) +#define LINEBYTES (((NUM_COLS - 1) / 8) + 1) /** The width (in pixels) of the margin around a LED. */ #define LED_MARGIN 1