mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-22 05:33:45 -04:00
render: maybe_resize(): convert local variable ‘scale’ to float
This commit is contained in:
parent
913ae94cf9
commit
4bd62b1005
1 changed files with 13 additions and 8 deletions
21
render.c
21
render.c
|
|
@ -3868,13 +3868,13 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
if (term->cell_width == 0 && term->cell_height == 0)
|
if (term->cell_width == 0 && term->cell_height == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int scale = -1;
|
float scale = -1;
|
||||||
tll_foreach(term->window->on_outputs, it) {
|
tll_foreach(term->window->on_outputs, it) {
|
||||||
if (it->item->scale > scale)
|
if (it->item->scale > scale)
|
||||||
scale = it->item->scale;
|
scale = it->item->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scale < 0) {
|
if (scale < 0.) {
|
||||||
/* Haven't 'entered' an output yet? */
|
/* Haven't 'entered' an output yet? */
|
||||||
scale = term->scale;
|
scale = term->scale;
|
||||||
}
|
}
|
||||||
|
|
@ -3922,13 +3922,18 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
* Ensure we can scale to logical size, and back to
|
* Ensure we can scale to logical size, and back to
|
||||||
* pixels without truncating.
|
* pixels without truncating.
|
||||||
*/
|
*/
|
||||||
if (width % scale)
|
if (wayl_fractional_scaling(term->wl)) {
|
||||||
width += scale - width % scale;
|
xassert((int)round(scale) == (int)scale);
|
||||||
if (height % scale)
|
|
||||||
height += scale - height % scale;
|
|
||||||
|
|
||||||
xassert(width % scale == 0);
|
int iscale = scale;
|
||||||
xassert(height % scale == 0);
|
if (width % iscale)
|
||||||
|
width += iscale - width % iscale;
|
||||||
|
if (height % iscale)
|
||||||
|
height += iscale - height % iscale;
|
||||||
|
|
||||||
|
xassert(width % iscale == 0);
|
||||||
|
xassert(height % iscale == 0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue