diff src/video/windib/SDL_dibvideo.c @ 338:518ffd98a8f6

Fixed gamma ramps in DirectX windowed and OpenGL modes
author Sam Lantinga <slouken@libsdl.org>
date Thu, 11 Apr 2002 15:23:07 +0000
parents ec53caed9fb2
children 3fc4e71f7714
line wrap: on
line diff
--- a/src/video/windib/SDL_dibvideo.c	Thu Apr 11 14:35:16 2002 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Thu Apr 11 15:23:07 2002 +0000
@@ -61,12 +61,10 @@
 static int DIB_SetColors(_THIS, int firstcolor, int ncolors,
 			 SDL_Color *colors);
 static void DIB_CheckGamma(_THIS);
-static void DIB_SwapGamma(_THIS);
-static void DIB_QuitGamma(_THIS);
-#ifndef NO_GAMMA_SUPPORT
-static int DIB_SetGammaRamp(_THIS, Uint16 *ramp);
-static int DIB_GetGammaRamp(_THIS, Uint16 *ramp);
-#endif
+void DIB_SwapGamma(_THIS);
+void DIB_QuitGamma(_THIS);
+int DIB_SetGammaRamp(_THIS, Uint16 *ramp);
+int DIB_GetGammaRamp(_THIS, Uint16 *ramp);
 static void DIB_VideoQuit(_THIS);
 
 /* Hardware surface functions */
@@ -142,10 +140,8 @@
 	device->UnlockHWSurface = DIB_UnlockHWSurface;
 	device->FlipHWSurface = NULL;
 	device->FreeHWSurface = DIB_FreeHWSurface;
-#ifndef NO_GAMMA_SUPPORT
 	device->SetGammaRamp = DIB_SetGammaRamp;
 	device->GetGammaRamp = DIB_GetGammaRamp;
-#endif
 #ifdef HAVE_OPENGL
         device->GL_LoadLibrary = WIN_GL_LoadLibrary;
         device->GL_GetProcAddress = WIN_GL_GetProcAddress;
@@ -169,7 +165,6 @@
 	/* Set up the windows message handling functions */
 	WIN_RealizePalette = DIB_RealizePalette;
 	WIN_PaletteChanged = DIB_PaletteChanged;
-	WIN_SwapGamma = DIB_SwapGamma;
 	WIN_WinPAINT = DIB_WinPAINT;
 	HandleMessage = DIB_HandleMessage;
 
@@ -807,7 +802,7 @@
 	ReleaseDC(SDL_Window, hdc);
 #endif /* !NO_GAMMA_SUPPORT */
 }
-static void DIB_SwapGamma(_THIS)
+void DIB_SwapGamma(_THIS)
 {
 #ifndef NO_GAMMA_SUPPORT
 	HDC hdc;
@@ -826,7 +821,7 @@
 	}
 #endif /* !NO_GAMMA_SUPPORT */
 }
-static void DIB_QuitGamma(_THIS)
+void DIB_QuitGamma(_THIS)
 {
 #ifndef NO_GAMMA_SUPPORT
 	if ( gamma_saved ) {
@@ -846,10 +841,12 @@
 #endif /* !NO_GAMMA_SUPPORT */
 }
 
-#ifndef NO_GAMMA_SUPPORT
-
-static int DIB_SetGammaRamp(_THIS, Uint16 *ramp)
+int DIB_SetGammaRamp(_THIS, Uint16 *ramp)
 {
+#ifdef NO_GAMMA_SUPPORT
+	SDL_SetError("SDL compiled without gamma ramp support");
+	return -1;
+#else
 	HDC hdc;
 	BOOL succeeded;
 
@@ -872,10 +869,15 @@
 		succeeded = TRUE;
 	}
 	return succeeded ? 0 : -1;
+#endif /* !NO_GAMMA_SUPPORT */
 }
 
-static int DIB_GetGammaRamp(_THIS, Uint16 *ramp)
+int DIB_GetGammaRamp(_THIS, Uint16 *ramp)
 {
+#ifdef NO_GAMMA_SUPPORT
+	SDL_SetError("SDL compiled without gamma ramp support");
+	return -1;
+#else
 	HDC hdc;
 	BOOL succeeded;
 
@@ -884,10 +886,9 @@
 	succeeded = GetDeviceGammaRamp(hdc, ramp);
 	ReleaseDC(SDL_Window, hdc);
 	return succeeded ? 0 : -1;
+#endif /* !NO_GAMMA_SUPPORT */
 }
 
-#endif /* !NO_GAMMA_SUPPORT */
-
 void DIB_VideoQuit(_THIS)
 {
 	/* Destroy the window and everything associated with it */