Commit 21cbdc8a authored by Frediano Ziglio's avatar Frediano Ziglio

Make grow_changed_tiles loop a bit more readable

It was not clear that a lot of tests were here just to handle
borders.
Signed-off-by: Frediano Ziglio's avatarFrediano Ziglio <freddy77@gmail.com>
parent 6a80b4b0
......@@ -210,7 +210,7 @@ static void grow_changed_tiles(scanner_t *scanner G_GNUC_UNUSED,
}
for (j = 0; j < NUM_HORIZONTAL_TILES; j++) {
int grow = 0;
bool grow;
if (tiles_changed[i][j]) {
continue;
......@@ -219,15 +219,14 @@ static void grow_changed_tiles(scanner_t *scanner G_GNUC_UNUSED,
/* You get good optimizations from having multiple rows,
so be more aggressive in growing the first and last tile;
just require a neighbor be set */
if (j == 0 && tiles_changed[i][1])
grow++;
else if (j == NUM_HORIZONTAL_TILES - 1 && tiles_changed[i][j - 1])
grow++;
if (j == 0)
grow = tiles_changed[i][1];
else if (j == NUM_HORIZONTAL_TILES - 1)
grow = tiles_changed[i][j - 1];
/* Otherwise, require that growing 'fills' a gap */
else if (j > 0 && j < (NUM_HORIZONTAL_TILES - 1) &&
tiles_changed[i][j - 1] && tiles_changed[i][j + 1])
grow++;
else
grow = tiles_changed[i][j - 1] && tiles_changed[i][j + 1];
if (grow) {
tiles_changed[i][j] = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment