mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-11 08:25:26 +00:00
SDL_EGL_ChooseConfig: cleanups and minor optimizations.
- Move an immutable condition out of a for loop. - Add a break statement to that loop when we find what we're looking for. - Add an assert to make sure we don't overflow a buffer. - Wrap a single-statement if block in braces. - Adjust some whitespace.
This commit is contained in:
parent
7d02248cf5
commit
4abe34461f
|
@ -775,6 +775,8 @@ SDL_EGL_ChooseConfig(_THIS)
|
||||||
|
|
||||||
attribs[i++] = EGL_NONE;
|
attribs[i++] = EGL_NONE;
|
||||||
|
|
||||||
|
SDL_assert(i < SDL_arraysize(attribs));
|
||||||
|
|
||||||
if (_this->egl_data->eglChooseConfig(_this->egl_data->egl_display,
|
if (_this->egl_data->eglChooseConfig(_this->egl_data->egl_display,
|
||||||
attribs,
|
attribs,
|
||||||
configs, SDL_arraysize(configs),
|
configs, SDL_arraysize(configs),
|
||||||
|
@ -784,15 +786,17 @@ SDL_EGL_ChooseConfig(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* first ensure that a found config has a matching format, or the function will fall through. */
|
/* first ensure that a found config has a matching format, or the function will fall through. */
|
||||||
for (i = 0; i < found_configs; i++ ) {
|
|
||||||
if (_this->egl_data->egl_required_visual_id)
|
if (_this->egl_data->egl_required_visual_id)
|
||||||
{
|
{
|
||||||
|
for (i = 0; i < found_configs; i++ ) {
|
||||||
EGLint format;
|
EGLint format;
|
||||||
_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
|
_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
|
||||||
configs[i],
|
configs[i],
|
||||||
EGL_NATIVE_VISUAL_ID, &format);
|
EGL_NATIVE_VISUAL_ID, &format);
|
||||||
if (_this->egl_data->egl_required_visual_id == format)
|
if (_this->egl_data->egl_required_visual_id == format) {
|
||||||
has_matching_format = SDL_TRUE;
|
has_matching_format = SDL_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue