mirror of
https://github.com/glfw/glfw.git
synced 2024-11-29 21:37:27 +00:00
Unified video mode enumeration.
This commit is contained in:
parent
4918514eaf
commit
468714cab9
@ -326,7 +326,7 @@ void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
|||||||
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||||
{
|
{
|
||||||
CFArrayRef modes;
|
CFArrayRef modes;
|
||||||
CFIndex count, i;
|
CFIndex count, i, j;
|
||||||
GLFWvidmode* result;
|
GLFWvidmode* result;
|
||||||
CVDisplayLinkRef link;
|
CVDisplayLinkRef link;
|
||||||
|
|
||||||
@ -340,12 +340,26 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
CGDisplayModeRef mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||||
if (modeIsGood(mode))
|
if (!modeIsGood(dm))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
|
||||||
|
|
||||||
|
for (j = 0; j < *found; j++)
|
||||||
{
|
{
|
||||||
result[*found] = vidmodeFromCGDisplayMode(mode, link);
|
if (_glfwCompareVideoModes(result + j, &mode) == 0)
|
||||||
(*found)++;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i < *found)
|
||||||
|
{
|
||||||
|
// This is a duplicate, so skip it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result[*found] = mode;
|
||||||
|
(*found)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFRelease(modes);
|
CFRelease(modes);
|
||||||
|
@ -352,13 +352,9 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
|
|
||||||
for (j = 0; j < *found; j++)
|
for (j = 0; j < *found; j++)
|
||||||
{
|
{
|
||||||
if (result[j].width == mode.width &&
|
if (_glfwCompareVideoModes(result + j, &mode) == 0)
|
||||||
result[j].height == mode.height &&
|
|
||||||
result[j].refreshRate == mode.refreshRate)
|
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (j < *found)
|
if (j < *found)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user