mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
sixel: resize: don’t resize beyond the current max geometry
This commit is contained in:
parent
8ec0f15a34
commit
839b7dd32e
1 changed files with 14 additions and 0 deletions
14
sixel.c
14
sixel.c
|
|
@ -855,6 +855,20 @@ resize(struct terminal *term, int new_width, int new_height)
|
|||
new_height = (new_height + 6 - 1) / 6 * 6;
|
||||
xassert(new_height % 6 == 0);
|
||||
|
||||
if (new_width > term->sixel.max_width)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* Last row may be cropped by the max height, but don’t skip that
|
||||
* last partial row entirely.
|
||||
*
|
||||
* I.e if max height is ‘4’, then allow resizing up to 6, to allow
|
||||
* us to emit that last sixel row. The final image will be cropped
|
||||
* to the current max geometry in unhook.
|
||||
*/
|
||||
if (new_height > (term->sixel.max_height + 5) / 6 * 6)
|
||||
return false;
|
||||
|
||||
uint32_t *new_data = NULL;
|
||||
|
||||
if (new_width == old_width) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue