aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-03-07 11:02:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-03-11 16:32:58 +0000
commitd35963f584acce3d2493e24348215d60345c861e (patch)
treea9d657b29432b1b90e8bc3ff2770fa25efa31cf8
parentsixel: set ‘col’ outside image boundaries when we’ve reached max height (diff)
sixel: resize: width is no longer a multiple of 6
-rw-r--r--sixel.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/sixel.c b/sixel.c
index 6003783c..55586df5 100644
--- a/sixel.c
+++ b/sixel.c
@@ -695,10 +695,6 @@ sixel_reflow(struct terminal *term)
void
sixel_unhook(struct terminal *term)
{
- /* The internal buffer always as a row number that is a multiple of 6 */
- term->sixel.image.height = min(
- term->sixel.image.height, term->sixel.max_height);
-
int pixel_row_idx = 0;
int pixel_rows_left = term->sixel.image.height;
const int stride = term->sixel.image.width * sizeof(uint32_t);
@@ -847,19 +843,11 @@ resize(struct terminal *term, int new_width, int new_height)
term->sixel.image.width, term->sixel.image.height,
new_width, new_height);
- 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)
+ if (new_width > term->sixel.max_width ||
+ new_height > term->sixel.max_height)
+ {
return false;
+ }
uint32_t *old_data = term->sixel.image.data;
const int old_width = term->sixel.image.width;