mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-23 05:33:57 -04:00
render: collect glyphs over *all* update damages
This commit is contained in:
parent
f2363c2391
commit
c35e10bd9a
1 changed files with 12 additions and 12 deletions
24
render.c
24
render.c
|
|
@ -54,9 +54,6 @@ grid_render_update(struct terminal *term, struct buffer *buf, const struct damag
|
||||||
|
|
||||||
const int cols = term->cols;
|
const int cols = term->cols;
|
||||||
|
|
||||||
gseq.g = gseq.glyphs;
|
|
||||||
gseq.count = 0;
|
|
||||||
|
|
||||||
for (int linear_cursor = start,
|
for (int linear_cursor = start,
|
||||||
row = ((start - term->grid->offset) % term->grid->size) / cols,
|
row = ((start - term->grid->offset) % term->grid->size) / cols,
|
||||||
col = ((start - term->grid->offset) % term->grid->size) % cols;
|
col = ((start - term->grid->offset) % term->grid->size) % cols;
|
||||||
|
|
@ -166,15 +163,6 @@ grid_render_update(struct terminal *term, struct buffer *buf, const struct damag
|
||||||
assert(gseq.count <= sizeof(gseq.glyphs) / sizeof(gseq.glyphs[0]));
|
assert(gseq.count <= sizeof(gseq.glyphs) / sizeof(gseq.glyphs[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gseq.count > 0) {
|
|
||||||
cairo_set_scaled_font(buf->cairo, attrs_to_font(term, &gseq.attrs));
|
|
||||||
cairo_set_source_rgba(
|
|
||||||
buf->cairo, gseq.foreground.r, gseq.foreground.g,
|
|
||||||
gseq.foreground.b, gseq.foreground.a);
|
|
||||||
cairo_set_operator(buf->cairo, CAIRO_OPERATOR_OVER);
|
|
||||||
cairo_show_glyphs(buf->cairo, gseq.glyphs, gseq.count);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_surface_damage_buffer(
|
wl_surface_damage_buffer(
|
||||||
term->wl.surface,
|
term->wl.surface,
|
||||||
0, ((dmg->range.start - term->grid->offset) / cols) * term->cell_height,
|
0, ((dmg->range.start - term->grid->offset) / cols) * term->cell_height,
|
||||||
|
|
@ -419,6 +407,9 @@ grid_render(struct terminal *term)
|
||||||
tll_remove(term->grid->scroll_damage, it);
|
tll_remove(term->grid->scroll_damage, it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gseq.g = gseq.glyphs;
|
||||||
|
gseq.count = 0;
|
||||||
|
|
||||||
tll_foreach(term->grid->damage, it) {
|
tll_foreach(term->grid->damage, it) {
|
||||||
switch (it->item.type) {
|
switch (it->item.type) {
|
||||||
case DAMAGE_ERASE: grid_render_erase(term, buf, &it->item); break;
|
case DAMAGE_ERASE: grid_render_erase(term, buf, &it->item); break;
|
||||||
|
|
@ -451,6 +442,15 @@ grid_render(struct terminal *term)
|
||||||
grid_render_update(term, buf, &cursor);
|
grid_render_update(term, buf, &cursor);
|
||||||
last_cursor = term->grid->offset + term->cursor.linear;
|
last_cursor = term->grid->offset + term->cursor.linear;
|
||||||
|
|
||||||
|
if (gseq.count > 0) {
|
||||||
|
cairo_set_scaled_font(buf->cairo, attrs_to_font(term, &gseq.attrs));
|
||||||
|
cairo_set_source_rgba(
|
||||||
|
buf->cairo, gseq.foreground.r, gseq.foreground.g,
|
||||||
|
gseq.foreground.b, gseq.foreground.a);
|
||||||
|
cairo_set_operator(buf->cairo, CAIRO_OPERATOR_OVER);
|
||||||
|
cairo_show_glyphs(buf->cairo, gseq.glyphs, gseq.count);
|
||||||
|
}
|
||||||
|
|
||||||
term->grid->offset %= term->grid->size;
|
term->grid->offset %= term->grid->size;
|
||||||
if (term->grid->offset < 0)
|
if (term->grid->offset < 0)
|
||||||
term->grid->offset += term->grid->size;
|
term->grid->offset += term->grid->size;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue