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

This commit is contained in:
André Hentschel 2011-08-11 20:35:11 +02:00 committed by Alexandre Julliard
parent 72c121e797
commit 4b538567e8
1 changed files with 10 additions and 20 deletions

View File

@ -386,35 +386,25 @@ static BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp)
static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp) static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
{ {
Bool ret = FALSE;
#ifdef X_XF86VidModeSetGamma #ifdef X_XF86VidModeSetGamma
XF86VidModeGamma gamma; XF86VidModeGamma gamma;
if (xf86vm_major < 2 || !usexvidmode) return FALSE; /* no gamma control */ if (xf86vm_major < 2 || !usexvidmode) return FALSE; /* no gamma control */
#ifdef X_XF86VidModeSetGammaRamp if (!ComputeGammaFromRamp(ramp->red, &gamma.red) || /* ramp validation */
else if (xf86vm_use_gammaramp) !ComputeGammaFromRamp(ramp->green, &gamma.green) ||
{ !ComputeGammaFromRamp(ramp->blue, &gamma.blue)) return FALSE;
Bool ret;
wine_tsx11_lock(); wine_tsx11_lock();
#ifdef X_XF86VidModeSetGammaRamp
if (xf86vm_use_gammaramp)
ret = pXF86VidModeSetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256, ret = pXF86VidModeSetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ramp->red, ramp->green, ramp->blue); ramp->red, ramp->green, ramp->blue);
wine_tsx11_unlock();
return ret;
}
#endif
else else
{ #endif
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); ret = pXF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
wine_tsx11_unlock(); wine_tsx11_unlock();
return ret;
}
}
#endif /* X_XF86VidModeSetGamma */ #endif /* X_XF86VidModeSetGamma */
return FALSE; return ret;
} }
#endif /* SONAME_LIBXXF86VM */ #endif /* SONAME_LIBXXF86VM */