Browse Source

out of bounds error in case the display width is not multiple of 8

feature/2015
Christian Kroll 12 years ago
parent
commit
92c4613cdb
  1. 4
      animations/fpmath_patterns.c

4
animations/fpmath_patterns.c

@ -413,7 +413,7 @@ typedef struct fixp_plasma_s
* function. Those results only need to be calculated for the first row of * function. Those results only need to be calculated for the first row of
* the current frame and are then reused for the remaining rows. * the current frame and are then reused for the remaining rows.
*/ */
fixp_t fFunc1[NUM_COLS]; fixp_t fFunc1[LINEBYTES * 8u];
/** /**
* This value is part of the formula for the second internal pattern * This value is part of the formula for the second internal pattern
* function. It needs to be calculated only once per frame. * function. It needs to be calculated only once per frame.
@ -460,7 +460,7 @@ static unsigned char fixAnimPlasma(unsigned char const x,
{ {
p->fFunc2CosArg = NUM_ROWS * fixCos(t) + fixScaleUp(NUM_ROWS); p->fFunc2CosArg = NUM_ROWS * fixCos(t) + fixScaleUp(NUM_ROWS);
p->fFunc2SinArg = NUM_COLS * fixSin(t) + fixScaleUp(NUM_COLS); p->fFunc2SinArg = NUM_COLS * fixSin(t) + fixScaleUp(NUM_COLS);
for (unsigned char i = NUM_COLS; i--;) for (unsigned char i = LINEBYTES * 8u; i--;)
{ {
p->fFunc1[i] = fixSin(fixMul(fixScaleUp(i), fPlasmaX) + t); p->fFunc1[i] = fixSin(fixMul(fixScaleUp(i), fPlasmaX) + t);
} }

Loading…
Cancel
Save