diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-05-08 07:18:45 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-05-12 18:06:15 +0000 |
| commit | a1d2044d75050e72b8150d2f11147cf58a533c7c (patch) | |
| tree | 5d3c7ffbdf4a6ea563b66cf1772caaabda06d245 /render.c | |
| parent | render: wip: re-apply last frame’s damage when forced to double buffer (diff) | |
render: subtract current frame’s damage when there’s no scroll damage
When re-applying the previous frame’s damage (due to us being forced
to double buffer), subtract the current frame’s damage from the
region-to-copy when there’s no scroll damage on the current frame.
When the current frame doesn’t have any scroll damage, the current
frame’s damage is in the same coordinate system as the previous
frame’s damage, and we can safely remove it from the region we copy
from.
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -2099,7 +2099,6 @@ grid_render(struct terminal *term) tll_free(term->render.last_buf->scroll_damage); #else -#if 0 /* * TODO: remove this frame’s damage from the region we * copy from the old frame. @@ -2138,7 +2137,7 @@ grid_render(struct terminal *term) term->cell_height); } } -#endif + tll_foreach(term->render.last_buf->scroll_damage, it) { switch (it->item.type) { case DAMAGE_SCROLL: @@ -2163,22 +2162,19 @@ grid_render(struct terminal *term) tll_remove(term->render.last_buf->scroll_damage, it); } -#if 0 - pixman_region32_subtract(&dirty, &term->render.last_buf->dirty, &dirty); - pixman_image_set_clip_region32(buf->pix[0], &dirty); -#else - pixman_image_set_clip_region32(buf->pix[0], &term->render.last_buf->dirty); -#endif + if (tll_length(term->grid->scroll_damage) == 0) { + pixman_region32_subtract(&dirty, &term->render.last_buf->dirty, &dirty); + pixman_image_set_clip_region32(buf->pix[0], &dirty); + } else + pixman_image_set_clip_region32(buf->pix[0], &term->render.last_buf->dirty); pixman_image_composite32( PIXMAN_OP_SRC, term->render.last_buf->pix[0], NULL, buf->pix[0], 0, 0, 0, 0, 0, 0, term->width, term->height); pixman_image_set_clip_region32(buf->pix[0], NULL); -#if 0 pixman_region32_fini(&dirty); #endif -#endif } else { |
