mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
wayland: surface_scale(): implement fractional scaling
This is done by setting the surface’s viewport destination
This commit is contained in:
parent
36818459e5
commit
8ccabb7974
1 changed files with 11 additions and 2 deletions
13
wayland.c
13
wayland.c
|
|
@ -1889,11 +1889,20 @@ wayl_surface_scale_explicit_width_height(
|
|||
const struct wayland *wayl, const struct wayl_surface *surf,
|
||||
int width, int height, float scale)
|
||||
{
|
||||
LOG_WARN("scaling by a factor of %.2f (legacy)", scale);
|
||||
|
||||
if (wayl_fractional_scaling(wayl)) {
|
||||
BUG("not yet implemented");
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
LOG_DBG("scaling by a factor of %.2f (fractional scaling)", scale);
|
||||
wp_viewport_set_destination(
|
||||
surf->viewport,
|
||||
round((float)width / scale),
|
||||
round((float)height / scale));
|
||||
#else
|
||||
BUG("wayl_fraction_scaling() returned true, "
|
||||
"but fractional scaling was not available at compile time").
|
||||
#endif
|
||||
} else {
|
||||
LOG_DBG("scaling by a factor of %.2f (legacy)", scale);
|
||||
wl_surface_set_buffer_scale(surf->surf, (int)scale);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue