Browse Source

double buffering enabled and drawing loop optimized

feature/2015
Christian Kroll 13 years ago
parent
commit
08be3d87f7
  1. 12
      animations/fpmath_patterns.c

12
animations/fpmath_patterns.c

@ -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;
} }
} }
} }

Loading…
Cancel
Save