mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-22 01:40:17 -05:00
sixel: resize: check new width/height against max geometry early
This commit is contained in:
parent
6416319a99
commit
891e0819f0
1 changed files with 9 additions and 9 deletions
18
sixel.c
18
sixel.c
|
|
@ -849,15 +849,6 @@ resize(struct terminal *term, int new_width, int new_height)
|
|||
term->sixel.image.width, term->sixel.image.height,
|
||||
new_width, new_height);
|
||||
|
||||
uint32_t *old_data = term->sixel.image.data;
|
||||
const int old_width = term->sixel.image.width;
|
||||
const int old_height = term->sixel.image.height;
|
||||
|
||||
int alloc_new_width = new_width;
|
||||
int alloc_new_height = (new_height + 6 - 1) / 6 * 6;
|
||||
xassert(alloc_new_height >= new_height);
|
||||
xassert(alloc_new_height - new_height < 6);
|
||||
|
||||
if (new_width > term->sixel.max_width)
|
||||
return false;
|
||||
|
||||
|
|
@ -872,6 +863,15 @@ resize(struct terminal *term, int new_width, int new_height)
|
|||
if (new_height > (term->sixel.max_height + 5) / 6 * 6)
|
||||
return false;
|
||||
|
||||
uint32_t *old_data = term->sixel.image.data;
|
||||
const int old_width = term->sixel.image.width;
|
||||
const int old_height = term->sixel.image.height;
|
||||
|
||||
int alloc_new_width = new_width;
|
||||
int alloc_new_height = (new_height + 6 - 1) / 6 * 6;
|
||||
xassert(alloc_new_height >= new_height);
|
||||
xassert(alloc_new_height - new_height < 6);
|
||||
|
||||
uint32_t *new_data = NULL;
|
||||
|
||||
if (new_width == old_width) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue