mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-16 14:56:00 +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
@@ -2210,7 +2210,6 @@ The following functions have been renamed:
|
|||||||
* SDL_SetWindowDisplayMode() => SDL_SetWindowFullscreenMode(), returns bool
|
* SDL_SetWindowDisplayMode() => SDL_SetWindowFullscreenMode(), returns bool
|
||||||
|
|
||||||
The following functions have been removed:
|
The following functions have been removed:
|
||||||
* SDL_GetClosestFullscreenDisplayMode()
|
|
||||||
* SDL_GetDisplayDPI() - not reliable across platforms, approximately replaced by multiplying SDL_GetWindowDisplayScale() times 160 on iPhone and Android, and 96 on other platforms.
|
* SDL_GetDisplayDPI() - not reliable across platforms, approximately replaced by multiplying SDL_GetWindowDisplayScale() times 160 on iPhone and Android, and 96 on other platforms.
|
||||||
* SDL_GetDisplayMode()
|
* SDL_GetDisplayMode()
|
||||||
* SDL_GetNumDisplayModes() - replaced with SDL_GetFullscreenDisplayModes()
|
* SDL_GetNumDisplayModes() - replaced with SDL_GetFullscreenDisplayModes()
|
||||||
|
@@ -665,7 +665,7 @@ extern SDL_DECLSPEC SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL
|
|||||||
* for the desktop refresh rate.
|
* for the desktop refresh rate.
|
||||||
* \param include_high_density_modes boolean to include high density modes in
|
* \param include_high_density_modes boolean to include high density modes in
|
||||||
* the search.
|
* the search.
|
||||||
* \param mode a pointer filled in with the closest display mode equal to or
|
* \param closest a pointer filled in with the closest display mode equal to or
|
||||||
* larger than the desired mode.
|
* larger than the desired mode.
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||||
* information.
|
* information.
|
||||||
@@ -675,7 +675,7 @@ extern SDL_DECLSPEC SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL
|
|||||||
* \sa SDL_GetDisplays
|
* \sa SDL_GetDisplays
|
||||||
* \sa SDL_GetFullscreenDisplayModes
|
* \sa SDL_GetFullscreenDisplayModes
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, SDL_DisplayMode *mode);
|
extern SDL_DECLSPEC bool SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, SDL_DisplayMode *closest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about the desktop's display mode.
|
* Get information about the desktop's display mode.
|
||||||
|
@@ -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)
|
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;
|
const SDL_DisplayMode *mode, *closest = NULL;
|
||||||
float aspect_ratio;
|
float aspect_ratio;
|
||||||
int i;
|
int i;
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
|
||||||
|
|
||||||
if (result) {
|
SDL_zerop(result);
|
||||||
SDL_zerop(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK_DISPLAY_MAGIC(display, false);
|
CHECK_DISPLAY_MAGIC(display, false);
|
||||||
|
|
||||||
@@ -1378,9 +1380,9 @@ bool SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h,
|
|||||||
if (!closest) {
|
if (!closest) {
|
||||||
return SDL_SetError("Couldn't find any matching video modes");
|
return SDL_SetError("Couldn't find any matching video modes");
|
||||||
}
|
}
|
||||||
if (result) {
|
|
||||||
SDL_copyp(result, closest);
|
SDL_copyp(result, closest);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user