Cleanup to fgSetupixelFormat(). Should be no functional changes.

Code facelift included:

 * Consistant indentation.
 * Removal of all TABs (there were a bunch).
 * Fit to 80 columns.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@273 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-10-31 04:25:34 +00:00
parent 807042d126
commit 570e2aa0b6

View File

@ -153,32 +153,22 @@ XVisualInfo* fgChooseVisual( void )
* Setup the pixel format for a Win32 window * Setup the pixel format for a Win32 window
*/ */
#if TARGET_HOST_WIN32 #if TARGET_HOST_WIN32
GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, unsigned char layer_type ) GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
unsigned char layer_type )
{ {
PIXELFORMATDESCRIPTOR* ppfd, pfd; PIXELFORMATDESCRIPTOR* ppfd, pfd;
int flags, pixelformat; int flags, pixelformat;
/*
* Check if the window seems valid
*/
freeglut_return_val_if_fail( window != NULL, 0 ); freeglut_return_val_if_fail( window != NULL, 0 );
/*
* The pixel format should allow us to draw to the window using OpenGL
*/
flags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; flags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
/*
* It might be the case for us to use double buffering
*/
if( fgState.DisplayMode & GLUT_DOUBLE ) if( fgState.DisplayMode & GLUT_DOUBLE )
flags |= PFD_DOUBLEBUFFER; flags |= PFD_DOUBLEBUFFER;
#pragma message( "fgSetupPixelFormat(): there is still some work to do here!" )
/* /*
* Specify which pixel format do we opt for... * Specify which pixel format do we opt for...
*/ */
# pragma message( "fgSetupPixelFormat(): there is still some work to do here!" )
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1; pfd.nVersion = 1;
pfd.dwFlags = flags; pfd.dwFlags = flags;
@ -211,29 +201,16 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, unsigned
pfd.dwVisibleMask = 0; pfd.dwVisibleMask = 0;
pfd.dwDamageMask = 0; pfd.dwDamageMask = 0;
/*
* Fill in the color bits...
*/
pfd.cColorBits = (BYTE) GetDeviceCaps( window->Window.Device, BITSPIXEL ); pfd.cColorBits = (BYTE) GetDeviceCaps( window->Window.Device, BITSPIXEL );
ppfd = &pfd; ppfd = &pfd;
/*
* Choose the pixel format that matches our demand
*/
pixelformat = ChoosePixelFormat( window->Window.Device, ppfd ); pixelformat = ChoosePixelFormat( window->Window.Device, ppfd );
if( pixelformat == 0 ) if( pixelformat == 0 )
return( FALSE ); return FALSE;
/*
* We might have been called to check if the pixel format exists only
*/
if( checkOnly ) if( checkOnly )
return( TRUE ); return TRUE;
return SetPixelFormat( window->Window.Device, pixelformat, ppfd );
/*
* Finally, set the window's pixel format
*/
return ( SetPixelFormat( window->Window.Device, pixelformat, ppfd ) ) ;
} }
#endif #endif