mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-04 17:06:25 +00:00
Take the display scale into account in SDL_GetWindowSizeInPixels()
This commit is contained in:
@@ -2395,7 +2395,15 @@ void SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h)
|
|||||||
if (_this->GetWindowSizeInPixels) {
|
if (_this->GetWindowSizeInPixels) {
|
||||||
_this->GetWindowSizeInPixels(_this, window, w, h);
|
_this->GetWindowSizeInPixels(_this, window, w, h);
|
||||||
} else {
|
} else {
|
||||||
|
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
||||||
|
|
||||||
SDL_GetWindowSize(window, w, h);
|
SDL_GetWindowSize(window, w, h);
|
||||||
|
|
||||||
|
if (display)
|
||||||
|
{
|
||||||
|
*w = (int)SDL_ceilf(*w * display->current_mode.display_scale);
|
||||||
|
*h = (int)SDL_ceilf(*h * display->current_mode.display_scale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user