[2/3] winex11: Validate the ramps also when not converting them to single values

André Hentschel nerv at dawncrow.de
Thu Aug 11 13:35:11 CDT 2011


This fixes http://bugs.winehq.org/show_bug.cgi?id=24598 for the game "And Yet It Moves"
The patch moves the existing validation of the ramps up, so that it's not only used for one case but for both (gamma ramp and single gamma value)
---
 dlls/winex11.drv/xvidmode.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c
index f866176..0dbd02b 100644
--- a/dlls/winex11.drv/xvidmode.c
+++ b/dlls/winex11.drv/xvidmode.c
@@ -389,7 +389,10 @@ static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
 #ifdef X_XF86VidModeSetGamma
   XF86VidModeGamma gamma;
 
-  if (xf86vm_major < 2 || !usexvidmode) return FALSE; /* no gamma control */
+  if (xf86vm_major < 2 || !usexvidmode || /* no gamma control */
+      !(ComputeGammaFromRamp(ramp->red,   &gamma.red) && /* ramp validation */
+        ComputeGammaFromRamp(ramp->green, &gamma.green) &&
+        ComputeGammaFromRamp(ramp->blue,  &gamma.blue))) return FALSE;
 #ifdef X_XF86VidModeSetGammaRamp
   else if (xf86vm_use_gammaramp)
   {
@@ -403,15 +406,11 @@ static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
 #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;
-      }
+      Bool ret;
+      wine_tsx11_lock();
+      ret = pXF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
+      wine_tsx11_unlock();
+      return ret;
   }
 #endif /* X_XF86VidModeSetGamma */
   return FALSE;
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list