mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-29 07:58:01 -04:00
render: use rounding for fractional scale
If we truncate the buffer dimensions we may accidentally submit a buffer with inappropriate size.
This commit is contained in:
parent
d1df98e0ca
commit
b7100d5716
4 changed files with 12 additions and 4 deletions
|
|
@ -49,6 +49,9 @@
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
* Use appropriate rounding when applying fractional scales.
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
|
|
|
||||||
4
render.c
4
render.c
|
|
@ -3856,8 +3856,8 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
scale = term->scale;
|
scale = term->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
width *= scale;
|
width = round(width * scale);
|
||||||
height *= scale;
|
height = round(height * scale);
|
||||||
|
|
||||||
if (width == 0 && height == 0) {
|
if (width == 0 && height == 0) {
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -778,7 +778,10 @@ term_set_fonts(struct terminal *term, struct fcft_font *fonts[static 4])
|
||||||
sixel_cell_size_changed(term);
|
sixel_cell_size_changed(term);
|
||||||
|
|
||||||
/* Use force, since cell-width/height may have changed */
|
/* Use force, since cell-width/height may have changed */
|
||||||
render_resize_force(term, term->width / term->scale, term->height / term->scale);
|
render_resize_force(
|
||||||
|
term,
|
||||||
|
round(term->width / term->scale),
|
||||||
|
round(term->height / term->scale));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -401,7 +401,9 @@ update_term_for_output_change(struct terminal *term)
|
||||||
|
|
||||||
float old_scale = term->scale;
|
float old_scale = term->scale;
|
||||||
|
|
||||||
render_resize(term, term->width / term->scale, term->height / term->scale);
|
render_resize(term,
|
||||||
|
round(term->width / term->scale),
|
||||||
|
round(term->height / term->scale));
|
||||||
term_font_dpi_changed(term, old_scale);
|
term_font_dpi_changed(term, old_scale);
|
||||||
term_font_subpixel_changed(term);
|
term_font_subpixel_changed(term);
|
||||||
csd_reload_font(term->window, old_scale);
|
csd_reload_font(term->window, old_scale);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue