]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_sdl.c
UNMERGE! Remove v_hwgamma feature as it is not worth maintaining and has severe restr...
[xonotic/darkplaces.git] / vid_sdl.c
index dc210ad44a9e94e9bb79f84500cfb3d22dd687dc..98d6567ee19bee9ac97f9dcc6ce119727dcbc11a 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -2848,6 +2848,7 @@ void VID_Shutdown (void)
 {
        VID_EnableJoystick(false);
        VID_SetMouse(false, false, false);
+       VID_RestoreSystemGamma();
 
 #if SDL_MAJOR_VERSION == 1
 #ifndef WIN32
@@ -2880,6 +2881,24 @@ void VID_Shutdown (void)
        gl_platformextensions = "";
 }
 
+int VID_SetGamma (unsigned short *ramps, int rampsize)
+{
+#if SDL_MAJOR_VERSION == 1
+       return !SDL_SetGammaRamp (ramps, ramps + rampsize, ramps + rampsize*2);
+#else
+       return !SDL_SetWindowGammaRamp (window, ramps, ramps + rampsize, ramps + rampsize*2);
+#endif
+}
+
+int VID_GetGamma (unsigned short *ramps, int rampsize)
+{
+#if SDL_MAJOR_VERSION == 1
+       return !SDL_GetGammaRamp (ramps, ramps + rampsize, ramps + rampsize*2);
+#else
+       return !SDL_GetWindowGammaRamp (window, ramps, ramps + rampsize, ramps + rampsize*2);
+#endif
+}
+
 void VID_Finish (void)
 {
 #if SDL_MAJOR_VERSION == 1
@@ -2893,7 +2912,7 @@ void VID_Finish (void)
 #endif
        vid_activewindow = !vid_hidden && vid_hasfocus;
 
-       VID_UpdateGamma();
+       VID_UpdateGamma(false, 256);
 
        if (!vid_hidden)
        {