Avoid mode re-enumeration, take two.

This commit is contained in:
Camilla Berglund 2013-06-07 15:11:26 +02:00
parent f4387139e0
commit 770daa19c8

View File

@ -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)) if (!refreshVideoModes(monitor))
return GL_FALSE; return NULL;
}
*count = monitor->modeCount; *count = monitor->modeCount;
return monitor->modes; return monitor->modes;