mirror of
https://github.com/glfw/glfw.git
synced 2026-09-19 07:05:49 +00: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:
+3
-2
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user