mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
Avoid mode re-enumeration, take two.
This commit is contained in:
+5
-5
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user