mirror of
https://github.com/glfw/glfw
synced 2026-09-26 16:18:21 +03:00
Wayland: Fix rounding of fractional scale sizes
The framebuffer size for fractional scale surfaces should be rounded to the closest integer, not truncated as is currently done. This implements the rounding formula that the discussions over at wayland-protocols item 132 and MR 309 appear to be converging on. Fixes #2713 Closes #2810
This commit is contained in:
parent
463cf73610
commit
b7ef2919b0
1 changed files with 3 additions and 2 deletions
|
|
@ -478,8 +478,9 @@ static void resizeFramebuffer(_GLFWwindow* window)
|
|||
{
|
||||
if (window->wl.fractionalScale)
|
||||
{
|
||||
window->wl.fbWidth = (window->wl.width * window->wl.scalingNumerator) / 120;
|
||||
window->wl.fbHeight = (window->wl.height * window->wl.scalingNumerator) / 120;
|
||||
// Round halfway away from zero per fractional-scale-v1 protocol spec
|
||||
window->wl.fbWidth = (window->wl.width * window->wl.scalingNumerator + 60) / 120;
|
||||
window->wl.fbHeight = (window->wl.height * window->wl.scalingNumerator + 60) / 120;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue