From 08be3d87f71af39e6b690e78b1d762332d8fcf74 Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Mon, 12 Sep 2011 22:16:04 +0000 Subject: [PATCH] double buffering enabled and drawing loop optimized --- animations/fpmath_patterns.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/animations/fpmath_patterns.c b/animations/fpmath_patterns.c index 635544c..bb5ca48 100644 --- a/animations/fpmath_patterns.c +++ b/animations/fpmath_patterns.c @@ -6,7 +6,7 @@ #include "../util.h" #include "fpmath_patterns.h" -#undef DOUBLE_BUFFERING +#define DOUBLE_BUFFERING #ifdef DOUBLE_BUFFERING #define BUFFER pixmap_buffer #else @@ -65,16 +65,18 @@ static void fpmath_pattern(double const t_start, { for (unsigned char x = 0; x < NUM_COLS; ++x) { - unsigned char color = fpPattern(x, y, t); - for (uint8_t p = NUMPLANE; p--;) + unsigned char const mask = shl_table[x % 8U]; + unsigned char const x8 = x / 8u; + unsigned char const color = fpPattern(x, y, t); + for (uint8_t p = 0; p < NUMPLANE; ++p) { if (p <= (color - 1)) { - BUFFER[p][y][x / 8] |= shl_table[x % 8U]; + BUFFER[p][y][x8] |= mask; } else { - BUFFER[p][y][x / 8] &= ~shl_table[x % 8U]; + BUFFER[p][y][x8] &= ~mask; } } }