From 6ad9cece24f83d3cea1b1f161eccb188daa01fe3 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 28 Mar 2006 13:09:42 +0000 Subject: [PATCH] an optimization to call XF86VidModeGetGammaRampSize only when opening the window, and assume the rampsize doesn't change after that git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6201 d7cf8633-e32d-0410-b094-e92efae38249 --- vid_glx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vid_glx.c b/vid_glx.c index eab081aa..150736df 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -93,6 +93,8 @@ static qboolean mouse_avail = true; static qboolean vid_usingmouse = false; static qboolean vid_usingvsync = false; static qboolean vid_usevsync = false; +static qboolean vid_x11_hardwaregammasupported = false; +static int vid_x11_gammarampsize = 0; static float mouse_x, mouse_y; static int p_mouse_x, p_mouse_y; @@ -561,7 +563,6 @@ void InitSig(void) void VID_Finish (qboolean allowmousegrab) { - int rampsize; qboolean vid_usemouse; vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable; @@ -589,8 +590,8 @@ void VID_Finish (qboolean allowmousegrab) qglXSwapBuffers(vidx11_display, win); } - if(XF86VidModeGetGammaRampSize(vidx11_display, vidx11_screen, &rampsize)) - VID_UpdateGamma(false, rampsize); + if (vid_x11_hardwaregammasupported) + VID_UpdateGamma(false, vid_x11_gammarampsize); } int VID_SetGamma(unsigned short *ramps, int rampsize) @@ -837,6 +838,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate vid_usingvsync = false; vid_hidden = false; vid_activewindow = true; + vid_x11_hardwaregammasupported = XF86VidModeGetGammaRampSize(vidx11_display, vidx11_screen, &vid_x11_gammarampsize) != 0; GL_Init(); return true; } -- 2.39.2