mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-06 04:06:06 -05:00
sixel: verify list order: fix assertion when two sixels are on the same row
Two sixel may in fact exist on the same row, assuming their columns don't overlap.
This commit is contained in:
parent
47d6dd0eee
commit
674f0dd0fc
1 changed files with 22 additions and 2 deletions
24
sixel.c
24
sixel.c
|
|
@ -113,13 +113,33 @@ verify_sixel_list_order(const struct terminal *term)
|
|||
{
|
||||
#if defined(_DEBUG)
|
||||
int prev_row = INT_MAX;
|
||||
int prev_col = -1;
|
||||
int prev_col_count = 0;
|
||||
|
||||
tll_foreach(term->grid->sixel_images, it) {
|
||||
int row = rebase_row(term, it->item.pos.row + it->item.rows - 1);
|
||||
assert(row < prev_row);
|
||||
if (row >= prev_row)
|
||||
int col = it->item.pos.col;
|
||||
int col_count = it->item.cols;
|
||||
|
||||
assert(row <= prev_row);
|
||||
if (row > prev_row)
|
||||
return false;
|
||||
|
||||
if (row == prev_row) {
|
||||
/* Allowed to be on the same row only if their columns
|
||||
* don't overlap */
|
||||
|
||||
assert(col + col_count <= prev_col ||
|
||||
prev_col + prev_col_count <= col);
|
||||
|
||||
if (!(col + col_count <= prev_col ||
|
||||
prev_col + prev_col_count <= col))
|
||||
return false;
|
||||
}
|
||||
|
||||
prev_row = row;
|
||||
prev_col = col;
|
||||
prev_col_count = col_count;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue