diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-03-07 10:08:01 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-03-11 16:32:57 +0000 |
| commit | 891e0819f0ed1f3812cf54c9071c7ff38715610c (patch) | |
| tree | 873842e57c2487a799f031d963c34f419c44ff6b | |
| parent | Revert "sixel: resize: always round up height to a multiple of 6" (diff) | |
sixel: resize: check new width/height against max geometry early
| -rw-r--r-- | sixel.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -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) { |
