mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 22:35:59 +00:00
SDL_GetClosestFullscreenDisplayMode(): Rename parameter mode
to closest
Also: Check, if the parameter is NULL inside the function.
This commit is contained in:

committed by
Sam Lantinga

parent
683991ab71
commit
96729e745a
@@ -1319,14 +1319,16 @@ SDL_DisplayMode **SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *co
|
||||
|
||||
bool SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, SDL_DisplayMode *result)
|
||||
{
|
||||
if (!result) {
|
||||
return SDL_InvalidParamError("closest"); // Parameter `result` is called `closest` in the header.
|
||||
}
|
||||
|
||||
const SDL_DisplayMode *mode, *closest = NULL;
|
||||
float aspect_ratio;
|
||||
int i;
|
||||
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
|
||||
|
||||
if (result) {
|
||||
SDL_zerop(result);
|
||||
}
|
||||
SDL_zerop(result);
|
||||
|
||||
CHECK_DISPLAY_MAGIC(display, false);
|
||||
|
||||
@@ -1378,9 +1380,9 @@ bool SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h,
|
||||
if (!closest) {
|
||||
return SDL_SetError("Couldn't find any matching video modes");
|
||||
}
|
||||
if (result) {
|
||||
SDL_copyp(result, closest);
|
||||
}
|
||||
|
||||
SDL_copyp(result, closest);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user