mirror of
https://github.com/glfw/glfw.git
synced 2024-11-23 02:25:10 +00:00
Merged logic fix from 2.7.1 trunk.
This commit is contained in:
parent
f93801c221
commit
fdcbb402a8
22
src/window.c
22
src/window.c
@ -256,18 +256,9 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
unsigned int missing, leastMissing = UINT_MAX;
|
unsigned int missing, leastMissing = UINT_MAX;
|
||||||
unsigned int colorDiff, leastColorDiff = UINT_MAX;
|
unsigned int colorDiff, leastColorDiff = UINT_MAX;
|
||||||
unsigned int extraDiff, leastExtraDiff = UINT_MAX;
|
unsigned int extraDiff, leastExtraDiff = UINT_MAX;
|
||||||
GLboolean desiresColor = GL_FALSE;
|
|
||||||
const _GLFWfbconfig* current;
|
const _GLFWfbconfig* current;
|
||||||
const _GLFWfbconfig* closest = NULL;
|
const _GLFWfbconfig* closest = NULL;
|
||||||
|
|
||||||
// Cache some long-winded preferences
|
|
||||||
|
|
||||||
if (desired->redBits || desired->greenBits || desired->blueBits ||
|
|
||||||
desired->alphaBits)
|
|
||||||
{
|
|
||||||
desiresColor = GL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
current = alternatives + i;
|
current = alternatives + i;
|
||||||
@ -383,12 +374,12 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Figure out if the current one is better than the best one found so far
|
// Figure out if the current one is better than the best one found so far
|
||||||
|
// Missing buffers is the most important heuristic, then color buffer size
|
||||||
|
// mismatches and lastly size mismatches for other buffers
|
||||||
|
|
||||||
if (missing < leastMissing)
|
if (missing < leastMissing)
|
||||||
closest = current;
|
closest = current;
|
||||||
else if (missing == leastMissing)
|
else if (missing == leastMissing)
|
||||||
{
|
|
||||||
if (desiresColor)
|
|
||||||
{
|
{
|
||||||
if ((colorDiff < leastColorDiff) ||
|
if ((colorDiff < leastColorDiff) ||
|
||||||
(colorDiff == leastColorDiff && extraDiff < leastExtraDiff))
|
(colorDiff == leastColorDiff && extraDiff < leastExtraDiff))
|
||||||
@ -396,15 +387,6 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
closest = current;
|
closest = current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((extraDiff < leastExtraDiff) ||
|
|
||||||
(extraDiff == leastExtraDiff && colorDiff < leastColorDiff))
|
|
||||||
{
|
|
||||||
closest = current;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current == closest)
|
if (current == closest)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user