double buffering enabled and drawing loop optimized

This commit is contained in:
Christian Kroll 2011-09-12 22:16:04 +00:00
parent f0c8d17bb4
commit 08be3d87f7
1 changed files with 7 additions and 5 deletions

View File

@ -6,7 +6,7 @@
#include "../util.h" #include "../util.h"
#include "fpmath_patterns.h" #include "fpmath_patterns.h"
#undef DOUBLE_BUFFERING #define DOUBLE_BUFFERING
#ifdef DOUBLE_BUFFERING #ifdef DOUBLE_BUFFERING
#define BUFFER pixmap_buffer #define BUFFER pixmap_buffer
#else #else
@ -65,16 +65,18 @@ static void fpmath_pattern(double const t_start,
{ {
for (unsigned char x = 0; x < NUM_COLS; ++x) for (unsigned char x = 0; x < NUM_COLS; ++x)
{ {
unsigned char color = fpPattern(x, y, t); unsigned char const mask = shl_table[x % 8U];
for (uint8_t p = NUMPLANE; p--;) 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)) if (p <= (color - 1))
{ {
BUFFER[p][y][x / 8] |= shl_table[x % 8U]; BUFFER[p][y][x8] |= mask;
} }
else else
{ {
BUFFER[p][y][x / 8] &= ~shl_table[x % 8U]; BUFFER[p][y][x8] &= ~mask;
} }
} }
} }