Ripped out horribly broken refresh rate mess.

This commit is contained in:
Camilla Berglund
2012-12-31 02:06:19 +01:00
parent 23c6def880
commit 52dac79219
13 changed files with 61 additions and 252 deletions
+2 -15
View File
@@ -139,13 +139,12 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode)
// Change the current video mode
//========================================================================
GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp, int* refreshRate)
GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp)
{
CGDisplayModeRef bestMode = NULL;
CFArrayRef modes;
CFIndex count, i;
unsigned int leastSizeDiff = UINT_MAX;
double leastRateDiff = DBL_MAX;
modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL);
count = CFArrayGetCount(modes);
@@ -177,23 +176,11 @@ GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp, int* refreshRate)
((modeWidth - *width) * (modeWidth - *width) +
(modeHeight - *height) * (modeHeight - *height));
double rateDiff;
if (*refreshRate > 0)
rateDiff = fabs(CGDisplayModeGetRefreshRate(mode) - *refreshRate);
else
{
// If no refresh rate was specified, then they're all the same
rateDiff = 0;
}
if ((sizeDiff < leastSizeDiff) ||
(sizeDiff == leastSizeDiff && (rateDiff < leastRateDiff)))
if (sizeDiff < leastSizeDiff)
{
bestMode = mode;
leastSizeDiff = sizeDiff;
leastRateDiff = rateDiff;
}
}