mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
add code for USE_GAMMA_RAMPS case for SDL2 builds. (still off by default.)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1053 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
11c1b1f67c
commit
f040037e64
1 changed files with 31 additions and 13 deletions
|
@ -124,10 +124,6 @@ cvar_t vid_gamma = {"gamma", "1", CVAR_ARCHIVE}; //johnfitz -- moved here from
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
#define USE_GAMMA_RAMPS 0
|
#define USE_GAMMA_RAMPS 0
|
||||||
#if (USE_GAMMA_RAMPS) && defined(USE_SDL2)
|
|
||||||
#undef USE_GAMMA_RAMPS /* not with SDL2 */
|
|
||||||
#define USE_GAMMA_RAMPS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_GAMMA_RAMPS
|
#if USE_GAMMA_RAMPS
|
||||||
static unsigned short vid_gamma_red[256];
|
static unsigned short vid_gamma_red[256];
|
||||||
|
@ -159,15 +155,22 @@ static void VID_Gamma_SetGamma (void)
|
||||||
value = GAMMA_MAX;
|
value = GAMMA_MAX;
|
||||||
|
|
||||||
#if defined(USE_SDL2)
|
#if defined(USE_SDL2)
|
||||||
|
# if USE_GAMMA_RAMPS
|
||||||
|
if (SDL_SetWindowGammaRamp(draw_context, vid_gamma_red, vid_gamma_green, vid_gamma_blue) != 0)
|
||||||
|
Con_Printf ("VID_Gamma_SetGamma: failed on SDL_SetWindowGammaRamp\n");
|
||||||
|
# else
|
||||||
if (SDL_SetWindowBrightness(draw_context, value) != 0)
|
if (SDL_SetWindowBrightness(draw_context, value) != 0)
|
||||||
Con_Printf ("VID_Gamma_SetGamma: failed on SDL_SetWindowBrightness\n");
|
Con_Printf ("VID_Gamma_SetGamma: failed on SDL_SetWindowBrightness\n");
|
||||||
#elif (USE_GAMMA_RAMPS)
|
# endif
|
||||||
|
#else /* USE_SDL2 */
|
||||||
|
# if USE_GAMMA_RAMPS
|
||||||
if (SDL_SetGammaRamp(vid_gamma_red, vid_gamma_green, vid_gamma_blue) == -1)
|
if (SDL_SetGammaRamp(vid_gamma_red, vid_gamma_green, vid_gamma_blue) == -1)
|
||||||
Con_Printf ("VID_Gamma_SetGamma: failed on SDL_SetGammaRamp\n");
|
Con_Printf ("VID_Gamma_SetGamma: failed on SDL_SetGammaRamp\n");
|
||||||
#else
|
# else
|
||||||
if (SDL_SetGamma(value,value,value) == -1)
|
if (SDL_SetGamma(value,value,value) == -1)
|
||||||
Con_Printf ("VID_Gamma_SetGamma: failed on SDL_SetGamma\n");
|
Con_Printf ("VID_Gamma_SetGamma: failed on SDL_SetGamma\n");
|
||||||
#endif
|
# endif
|
||||||
|
#endif /* USE_SDL2 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,15 +184,22 @@ static void VID_Gamma_Restore (void)
|
||||||
if (draw_context && gammaworks)
|
if (draw_context && gammaworks)
|
||||||
{
|
{
|
||||||
#if defined(USE_SDL2)
|
#if defined(USE_SDL2)
|
||||||
|
# if USE_GAMMA_RAMPS
|
||||||
|
if (SDL_SetWindowGammaRamp(draw_context, vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) != 0)
|
||||||
|
Con_Printf ("VID_Gamma_Restore: failed on SDL_SetWindowGammaRamp\n");
|
||||||
|
# else
|
||||||
if (SDL_SetWindowBrightness(draw_context, 1) != 0)
|
if (SDL_SetWindowBrightness(draw_context, 1) != 0)
|
||||||
Con_Printf ("VID_Gamma_Restore: failed on SDL_SetWindowBrightness\n");
|
Con_Printf ("VID_Gamma_Restore: failed on SDL_SetWindowBrightness\n");
|
||||||
#elif (USE_GAMMA_RAMPS)
|
# endif
|
||||||
|
#else /* USE_SDL2 */
|
||||||
|
# if USE_GAMMA_RAMPS
|
||||||
if (SDL_SetGammaRamp(vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) == -1)
|
if (SDL_SetGammaRamp(vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) == -1)
|
||||||
Con_Printf ("VID_Gamma_Restore: failed on SDL_SetGammaRamp\n");
|
Con_Printf ("VID_Gamma_Restore: failed on SDL_SetGammaRamp\n");
|
||||||
#else
|
# else
|
||||||
if (SDL_SetGamma(1, 1, 1) == -1)
|
if (SDL_SetGamma(1, 1, 1) == -1)
|
||||||
Con_Printf ("VID_Gamma_Restore: failed on SDL_SetGamma\n");
|
Con_Printf ("VID_Gamma_Restore: failed on SDL_SetGamma\n");
|
||||||
#endif
|
# endif
|
||||||
|
#endif /* USE_SDL2 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,14 +242,22 @@ VID_Gamma_Init -- call on init
|
||||||
static void VID_Gamma_Init (void)
|
static void VID_Gamma_Init (void)
|
||||||
{
|
{
|
||||||
#if defined(USE_SDL2)
|
#if defined(USE_SDL2)
|
||||||
|
# if USE_GAMMA_RAMPS
|
||||||
|
gammaworks = (SDL_GetWindowGammaRamp(draw_context, vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) == 0);
|
||||||
|
if (gammaworks)
|
||||||
|
gammaworks = (SDL_SetWindowGammaRamp(draw_context, vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) == 0);
|
||||||
|
# else
|
||||||
gammaworks = (SDL_SetWindowBrightness(draw_context, 1) == 0);
|
gammaworks = (SDL_SetWindowBrightness(draw_context, 1) == 0);
|
||||||
#elif (USE_GAMMA_RAMPS)
|
# endif
|
||||||
|
#else /* USE_SDL2 */
|
||||||
|
# if USE_GAMMA_RAMPS
|
||||||
gammaworks = (SDL_GetGammaRamp(vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) == 0);
|
gammaworks = (SDL_GetGammaRamp(vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) == 0);
|
||||||
if (gammaworks)
|
if (gammaworks)
|
||||||
gammaworks = (SDL_SetGammaRamp(vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) == 0);
|
gammaworks = (SDL_SetGammaRamp(vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) == 0);
|
||||||
#else
|
# else
|
||||||
gammaworks = (SDL_SetGamma(1, 1, 1) == 0);
|
gammaworks = (SDL_SetGamma(1, 1, 1) == 0);
|
||||||
#endif
|
# endif
|
||||||
|
#endif /* USE_SDL2 */
|
||||||
|
|
||||||
if (!gammaworks)
|
if (!gammaworks)
|
||||||
Con_SafePrintf("gamma adjustment not available\n");
|
Con_SafePrintf("gamma adjustment not available\n");
|
||||||
|
|
Loading…
Reference in a new issue