diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2023-07-30 05:53:33 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2023-07-30 05:53:33 +0000 |
| commit | 1af0277564f6347caa85fda4b46071c0cf03234c (patch) | |
| tree | 3199d56c7eca813a69c0bd57aa5deee8da2b6c71 /render.c | |
| parent | Merge branch 'csd-fractional-scaling' (diff) | |
--window-size-chars: ensure width/height are valid for current scaling factor
Before this patch, we didn’t ensure width and height were valid for
the current scaling factor, when fractional scaling _is_
available. That is, we didn’t ensure the width/height values
multiplied back to their original values after dividing with the
scaling factor.
Closes #1446
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -3933,22 +3933,9 @@ maybe_resize(struct terminal *term, int width, int height, bool force) width += 2 * term->conf->pad_x * scale; height += 2 * term->conf->pad_y * scale; - /* - * Ensure we can scale to logical size, and back to - * pixels without truncating. - */ - if (!term_fractional_scaling(term)) { - xassert((int)ceilf(scale) == (int)scale); - - int iscale = scale; - if (width % iscale) - width += iscale - width % iscale; - if (height % iscale) - height += iscale - height % iscale; - - xassert(width % iscale == 0); - xassert(height % iscale == 0); - } + /* Ensure width/height is a valid multiple of scale */ + width = roundf(scale * roundf(width / scale)); + height = roundf(scale * roundf(height / scale)); break; } } |
