From 0546f195efead281dbd0601acc5fcfcb82cc88f9 Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Thu, 15 May 2014 11:11:56 +0200 Subject: [PATCH] fixed mapping bug in moire.c --- src/animations/moire.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/animations/moire.c b/src/animations/moire.c index ce35b30..16b0ef8 100644 --- a/src/animations/moire.c +++ b/src/animations/moire.c @@ -45,25 +45,25 @@ void moire(void) // walk around the border; do that by mapping a linear increasing value // to appropriate screen coordinates - // first pixel is between top right and top left corner - if (pos < NUM_COLS) + // pixel is between top right and top left corner + if (pos < (NUM_COLS - 1)) { - p1.x = pos; + p1.x = pos + 1; } - // first pixel is between top left and bottom left corner - else if (pos < (NUM_COLS + NUM_ROWS - 1)) + // pixel is between top left and bottom left corner + else if (pos < (NUM_COLS + NUM_ROWS - 2)) { - p1.y = pos - (NUM_COLS - 1); + p1.y = pos - (NUM_COLS - 2); } - // first pixel is between bottom left and bottom right corner - else if (pos < (2 * NUM_COLS + NUM_ROWS - 2)) + // pixel is between bottom left and bottom right corner + else if (pos < (2 * NUM_COLS + NUM_ROWS - 3)) { - p1.x = 2 * NUM_COLS + NUM_ROWS - 3 - pos; + p1.x = 2 * NUM_COLS + NUM_ROWS - 4 - pos; } - // first pixel is between bottom right and top left corner + // pixel is between bottom right and top left corner else { - p1.y = 3 * NUM_COLS + NUM_ROWS - 4 - pos; + p1.y = 2 * NUM_COLS + 2 * NUM_ROWS - 5 - pos; } // second pixel in opposite direction