André Hentschel : winex11: Validate the ramps also when not converting them to single values.

Alexandre Julliard julliard at winehq.org
Tue Aug 23 12:44:55 CDT 2011


Module: wine
Branch: master
Commit: 4b538567e8e16b1c10a07176d750bafcacc3b543
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4b538567e8e16b1c10a07176d750bafcacc3b543

Author: André Hentschel <nerv at dawncrow.de>
Date:   Thu Aug 11 20:35:11 2011 +0200

winex11: Validate the ramps also when not converting them to single values.

---

 dlls/winex11.drv/xvidmode.c |   30 ++++++++++--------------------
 1 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c
index c09fe39..732a2d7 100644
--- a/dlls/winex11.drv/xvidmode.c
+++ b/dlls/winex11.drv/xvidmode.c
@@ -386,35 +386,25 @@ static BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp)
 
 static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
 {
+  Bool ret = FALSE;
 #ifdef X_XF86VidModeSetGamma
   XF86VidModeGamma gamma;
 
   if (xf86vm_major < 2 || !usexvidmode) return FALSE; /* no gamma control */
+  if (!ComputeGammaFromRamp(ramp->red,   &gamma.red) || /* ramp validation */
+      !ComputeGammaFromRamp(ramp->green, &gamma.green) ||
+      !ComputeGammaFromRamp(ramp->blue,  &gamma.blue)) return FALSE;
+  wine_tsx11_lock();
 #ifdef X_XF86VidModeSetGammaRamp
-  else if (xf86vm_use_gammaramp)
-  {
-      Bool ret;
-      wine_tsx11_lock();
+  if (xf86vm_use_gammaramp)
       ret = pXF86VidModeSetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
 				    ramp->red, ramp->green, ramp->blue);
-      wine_tsx11_unlock();
-      return ret;
-  }
-#endif
   else
-  {
-      if (ComputeGammaFromRamp(ramp->red,   &gamma.red) &&
-	  ComputeGammaFromRamp(ramp->green, &gamma.green) &&
-	  ComputeGammaFromRamp(ramp->blue,  &gamma.blue)) {
-	  Bool ret;
-	  wine_tsx11_lock();
-	  ret = pXF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
-	  wine_tsx11_unlock();
-	  return ret;
-      }
-  }
+#endif
+      ret = pXF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
+  wine_tsx11_unlock();
 #endif /* X_XF86VidModeSetGamma */
-  return FALSE;
+  return ret;
 }
 
 #endif /* SONAME_LIBXXF86VM */




More information about the wine-cvs mailing list