Everyone needs to be able to split BPPs these days.

This commit is contained in:
Camilla Berglund
2010-09-16 03:48:19 +02:00
parent df63d148e5
commit 3089e60fbd
5 changed files with 37 additions and 54 deletions
+2 -25
View File
@@ -34,29 +34,6 @@
#include <stdlib.h>
//========================================================================
// Convert BPP to RGB bits (based on "best guess")
//========================================================================
static void bpp2rgb(int bpp, int* r, int* g, int* b)
{
int delta;
// Special case: BPP = 32 (I don't think this is necessary for X11??)
if (bpp == 32)
bpp = 24;
// Convert "bits per pixel" to red, green & blue sizes
*r = *g = *b = bpp / 3;
delta = bpp - (*r * 3);
if (delta >= 1)
*g = *g + 1;
if (delta == 2)
*r = *r + 1;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
@@ -391,7 +368,7 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
depth = vislist[k].depth;
// Convert to RGB
bpp2rgb(depth, &r, &g, &b);
_glfwSplitBPP(depth, &r, &g, &b);
depth = (r << 16) | (g << 8) | b;
// Is this mode unique?
@@ -516,7 +493,7 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
bpp = DefaultDepth(dpy, screen);
// Convert BPP to RGB bits
bpp2rgb(bpp, &mode->redBits, &mode->greenBits, &mode->blueBits);
_glfwSplitBPP(bpp, &mode->redBits, &mode->greenBits, &mode->blueBits);
#if defined(_GLFW_HAS_XRANDR)
if (_glfwLibrary.X11.XRandR.available)