mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
term: performance: use a bitfield to track which ascii printer to use
The things affecting which ASCII printer we use have grown... Instead of checking everything inside term_update_ascii_printer(), use a bitfield. Anything affecting the printer used, must now set a bit in this bitfield. This makes term_update_ascii_printer() much faster, since all it needs to do is check if the bitfield is zero or not.
This commit is contained in:
parent
22302d8bcc
commit
48cf57818d
5 changed files with 63 additions and 13 deletions
11
sixel.c
11
sixel.c
|
|
@ -420,6 +420,8 @@ sixel_scroll_up(struct terminal *term, int rows)
|
|||
}
|
||||
}
|
||||
|
||||
term->bits_affecting_ascii_printer.sixels =
|
||||
tll_length(term->grid->sixel_images) > 0;
|
||||
term_update_ascii_printer(term);
|
||||
verify_sixels(term);
|
||||
}
|
||||
|
|
@ -444,6 +446,8 @@ sixel_scroll_down(struct terminal *term, int rows)
|
|||
break;
|
||||
}
|
||||
|
||||
term->bits_affecting_ascii_printer.sixels =
|
||||
tll_length(term->grid->sixel_images) > 0;
|
||||
term_update_ascii_printer(term);
|
||||
verify_sixels(term);
|
||||
}
|
||||
|
|
@ -852,6 +856,8 @@ sixel_overwrite_by_rectangle(
|
|||
} else
|
||||
_sixel_overwrite_by_rectangle(term, start, col, height, width, NULL, NULL);
|
||||
|
||||
term->bits_affecting_ascii_printer.sixels =
|
||||
tll_length(term->grid->sixel_images) > 0;
|
||||
term_update_ascii_printer(term);
|
||||
}
|
||||
|
||||
|
|
@ -908,6 +914,8 @@ sixel_overwrite_by_row(struct terminal *term, int _row, int col, int width)
|
|||
}
|
||||
}
|
||||
|
||||
term->bits_affecting_ascii_printer.sixels =
|
||||
tll_length(term->grid->sixel_images) > 0;
|
||||
term_update_ascii_printer(term);
|
||||
}
|
||||
|
||||
|
|
@ -1387,6 +1395,9 @@ sixel_unhook(struct terminal *term)
|
|||
LOG_DBG("you now have %zu sixels in current grid",
|
||||
tll_length(term->grid->sixel_images));
|
||||
|
||||
|
||||
term->bits_affecting_ascii_printer.sixels =
|
||||
tll_length(term->grid->sixel_images) > 0;
|
||||
term_update_ascii_printer(term);
|
||||
render_refresh(term);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue