mirror of https://github.com/encounter/SDL.git
wayland: Round fractional backbuffer sizes halfway away from zero
Use SDL_lroundf() to round fractional backbuffer sizes halfway away from zero, as this is the rounding method recommended by the forthcoming Wayland fractional scaling protocol.
This commit is contained in:
parent
ff735b3c0f
commit
c11bdeeb69
|
@ -184,8 +184,9 @@ GetBufferSize(SDL_Window *window, int *width, int *height)
|
||||||
if (FullscreenModeEmulation(window)) {
|
if (FullscreenModeEmulation(window)) {
|
||||||
GetFullScreenDimensions(window, NULL, NULL, &buf_width, &buf_height);
|
GetFullScreenDimensions(window, NULL, NULL, &buf_width, &buf_height);
|
||||||
} else if (NeedViewport(window)) {
|
} else if (NeedViewport(window)) {
|
||||||
buf_width = (int)SDL_ceil(window->w * data->scale_factor);
|
/* Round fractional backbuffer sizes halfway away from zero. */
|
||||||
buf_height = (int)SDL_ceil(window->h * data->scale_factor);
|
buf_width = (int)SDL_lroundf(window->w * data->scale_factor);
|
||||||
|
buf_height = (int)SDL_lroundf(window->h * data->scale_factor);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Integer scaled windowed or fullscreen with no viewport
|
* Integer scaled windowed or fullscreen with no viewport
|
||||||
|
@ -1897,8 +1898,8 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
|
||||||
}
|
}
|
||||||
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
|
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
|
||||||
|
|
||||||
data->drawable_width = SDL_ceilf(window->w * data->scale_factor);
|
data->drawable_width = SDL_lroundf(window->w * data->scale_factor);
|
||||||
data->drawable_height = SDL_ceilf(window->h * data->scale_factor);
|
data->drawable_height = SDL_lroundf(window->h * data->scale_factor);
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
if (window->flags & SDL_WINDOW_OPENGL) {
|
||||||
data->egl_window = WAYLAND_wl_egl_window_create(data->surface, data->drawable_width, data->drawable_height);
|
data->egl_window = WAYLAND_wl_egl_window_create(data->surface, data->drawable_width, data->drawable_height);
|
||||||
|
|
Loading…
Reference in New Issue