mirror of
https://github.com/glfw/glfw.git
synced 2024-11-29 15:44:35 +00:00
Avoid mode re-enumeration, take two.
This commit is contained in:
parent
f4387139e0
commit
770daa19c8
@ -79,6 +79,9 @@ static int refreshVideoModes(_GLFWmonitor* monitor)
|
|||||||
{
|
{
|
||||||
int modeCount;
|
int modeCount;
|
||||||
|
|
||||||
|
if (monitor->modes)
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
GLFWvidmode* modes = _glfwPlatformGetVideoModes(monitor, &modeCount);
|
GLFWvidmode* modes = _glfwPlatformGetVideoModes(monitor, &modeCount);
|
||||||
if (!modes)
|
if (!modes)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -340,11 +343,8 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
|||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
if (monitor->modes == NULL)
|
if (!refreshVideoModes(monitor))
|
||||||
{
|
return NULL;
|
||||||
if (!refreshVideoModes(monitor))
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*count = monitor->modeCount;
|
*count = monitor->modeCount;
|
||||||
return monitor->modes;
|
return monitor->modes;
|
||||||
|
Loading…
Reference in New Issue
Block a user