aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'render.c')
-rw-r--r--render.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/render.c b/render.c
index 90856bef..99ca03e3 100644
--- a/render.c
+++ b/render.c
@@ -504,9 +504,7 @@ draw_cursor:
static void
render_margin(struct terminal *term, struct buffer *buf,
- int start_line, int end_line,
- bool damage_top, bool damage_bottom,
- bool damage_left, bool damage_right)
+ int start_line, int end_line, bool apply_damage)
{
/* Fill area outside the cell grid with the default background color */
const int rmargin = term->width - term->margins.right;
@@ -537,25 +535,27 @@ render_margin(struct terminal *term, struct buffer *buf,
term->margins.right, line_count * term->cell_height},
});
- if (damage_top)
+ if (apply_damage) {
+ /* Top */
wl_surface_damage_buffer(
term->window->surface, 0, 0, term->width, term->margins.top);
- if (damage_bottom)
+ /* Bottom */
wl_surface_damage_buffer(
term->window->surface, 0, bmargin, term->width, term->margins.bottom);
- if (damage_left)
+ /* Left */
wl_surface_damage_buffer(
term->window->surface,
0, term->margins.top + start_line * term->cell_height,
term->margins.left, line_count * term->cell_height);
- if (damage_right)
+ /* Right */
wl_surface_damage_buffer(
term->window->surface,
rmargin, term->margins.top + start_line * term->cell_height,
term->margins.right, line_count * term->cell_height);
+ }
}
static void
@@ -633,8 +633,7 @@ grid_render_scroll(struct terminal *term, struct buffer *buf,
if (did_shm_scroll) {
/* Restore margins */
render_margin(
- term, buf, dmg->region.end - dmg->lines, term->rows,
- true, true, true, true);
+ term, buf, dmg->region.end - dmg->lines, term->rows, false);
} else {
/* Fallback for when we either cannot do SHM scrolling, or it failed */
uint8_t *raw = buf->mmapped;
@@ -699,8 +698,7 @@ grid_render_scroll_reverse(struct terminal *term, struct buffer *buf,
if (did_shm_scroll) {
/* Restore margins */
render_margin(
- term, buf, dmg->region.start, dmg->region.start + dmg->lines,
- true, true, true, true);
+ term, buf, dmg->region.start, dmg->region.start + dmg->lines, false);
} else {
/* Fallback for when we either cannot do SHM scrolling, or it failed */
uint8_t *raw = buf->mmapped;
@@ -1341,7 +1339,7 @@ grid_render(struct terminal *term)
else {
tll_free(term->grid->scroll_damage);
- render_margin(term, buf, 0, term->rows, true, true, true, true);
+ render_margin(term, buf, 0, term->rows, true);
term_damage_view(term);
}