mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-29 20:57:59 +08:00
video: Ensure that the closest returned video mode match always has a valid scale value
This commit is contained in:
committed by
Sam Lantinga
parent
5970311353
commit
6895e1700f
@@ -1014,7 +1014,13 @@ static SDL_DisplayMode *SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *di
|
|||||||
closest->w = mode->w;
|
closest->w = mode->w;
|
||||||
closest->h = mode->h;
|
closest->h = mode->h;
|
||||||
}
|
}
|
||||||
closest->display_scale = mode->display_scale;
|
if (match->display_scale > 0.0f) {
|
||||||
|
closest->display_scale = match->display_scale;
|
||||||
|
} else if (mode->display_scale > 0.0f) {
|
||||||
|
closest->display_scale = mode->display_scale;
|
||||||
|
} else {
|
||||||
|
closest->display_scale = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if (match->refresh_rate > 0.0f) {
|
if (match->refresh_rate > 0.0f) {
|
||||||
closest->refresh_rate = match->refresh_rate;
|
closest->refresh_rate = match->refresh_rate;
|
||||||
|
|||||||
Reference in New Issue
Block a user