X11: Fix map expose area

The stop_row and stop_col were off-by-one in some cases, leaving
black lines on the map when a window on top was closed.
Simplify the calculation by always going one row/col further,
ensuring previously covered area gets redrawn for sure.
This should not affect speed or resource usage noticeably these days.
This commit is contained in:
Pasi Kallinen
2022-01-25 11:26:47 +02:00
parent 0652f7f774
commit 61f78318a5
2 changed files with 3 additions and 4 deletions
+2 -4
View File
@@ -1199,12 +1199,10 @@ map_exposed(Widget w, XtPointer client_data, /* unused */
t_width = map_info->text_map.square_width;
}
start_row = y / t_height;
stop_row = ((y + height) / t_height)
+ ((((y + height) % t_height) == 0) ? 0 : 1) - 1;
stop_row = ((y + height) / t_height) + 1;
start_col = x / t_width;
stop_col = ((x + width) / t_width)
+ ((((x + width) % t_width) == 0) ? 0 : 1) - 1;
stop_col = ((x + width) / t_width) + 1;
#ifdef VERBOSE
printf("map_exposed: x = %d, y = %d, width = %d, height = %d\n", x, y,