diff options
author | Frediano Ziglio <freddy77@gmail.com> | 2020-04-28 10:21:10 +0100 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2020-05-06 13:36:49 +0100 |
commit | 37445f47843fadcb718b3a5604e3cfb6889d3b1f (patch) | |
tree | faa1fd42fc2d157d62e55b1302d65629f0cdd09e | |
parent | 4d367e3389b4846ebf39d24ad5440e4a2b52c65e (diff) |
Simplify computation of num_vertical_tiles
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
-rw-r--r-- | src/scan.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -322,9 +322,8 @@ static void scanner_periodic(scanner_t *scanner) int rc; g_mutex_lock(scanner->session->lock); - num_vertical_tiles = scanner->session->display.fullscreen->h / NUM_SCANLINES; - if (scanner->session->display.fullscreen->h % NUM_SCANLINES) - num_vertical_tiles++; + num_vertical_tiles = + (scanner->session->display.fullscreen->h + NUM_SCANLINES - 1) / NUM_SCANLINES; int tiles_changed_in_row[num_vertical_tiles]; bool tiles_changed[num_vertical_tiles][NUM_HORIZONTAL_TILES]; @@ -357,9 +356,8 @@ static void scan_full_screen(scanner_t *scanner) int rc; g_mutex_lock(scanner->session->lock); - num_vertical_tiles = scanner->session->display.fullscreen->h / NUM_SCANLINES; - if (scanner->session->display.fullscreen->h % NUM_SCANLINES) - num_vertical_tiles++; + num_vertical_tiles = + (scanner->session->display.fullscreen->h + NUM_SCANLINES - 1) / NUM_SCANLINES; int tiles_changed_in_row[num_vertical_tiles]; bool tiles_changed[num_vertical_tiles][NUM_HORIZONTAL_TILES]; |