Detect and fix up non-premultiplied cursor data
X server >= 1.18 already had code for this, but it only caught cases where some pixels have 0 for alpha and non-0 for a non-alpha component. Turns out some apps (e.g. the Civilization VI game) use non-premultiplied cursor data which doesn't have such pixels, but can still result in visual artifacts.
This uses the method suggested by Kamil in https://bugs.freedesktop.org/92309#c19: check for pixels where any colour component value is larger than the alpha value, which isn't possible with premultiplied alpha.
There can still be non-premultiplied data which won't be caught by this, but that should result in slightly incorrect colours and/or blending at the worst, not wildly incorrect colours such as shown in the bug report below.
v2:
- Disable the check with current xserver Git master, which already does the same check now.
Bugzilla: https://bugs.freedesktop.org/108355 Suggested-by: Kamil Páral kamil.paral@gmail.com