Relax detection of non-premultiplied alpha cursor data

The stricter detection broke the cursor in some games. Apparently those
use cursor data with premultiplied alpha, but with some pixels having
r/g/b values larger than the alpha value (which corresponds to original
r/g/b values > 1.0), triggering the workaround.

Relax the detection to match what's in the X server since 1.18.4, but
keep the workaround for older versions.

Bugzilla: https://bugs.freedesktop.org/108650
Acked-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Michel Dänzer
2018-11-06 12:06:20 +01:00
committed by Michel Dänzer
parent a9da219e13
commit 426f9a4965

View File

@@ -1509,8 +1509,8 @@ drmmode_cursor_pixel(xf86CrtcPtr crtc, uint32_t *argb, Bool premultiplied,
int i;
if (premultiplied) {
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 20, 99, 0, 0)
if (*argb > (alpha | alpha << 8 | alpha << 16 | alpha << 24))
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 18, 4, 0, 0)
if (alpha == 0 && (*argb & 0xffffff) != 0)
/* Doesn't look like premultiplied alpha */
return FALSE;
#endif