Revert "dix: Work around non-premultiplied ARGB cursor data harder"

This reverts commit b45c74f0f2.

It broke the cursor in other 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.

Seems the cure turned out worse than the disease, so revert.

Bugzilla: https://bugs.freedesktop.org/108650
This commit is contained in:
Michel Dänzer 2018-11-06 11:33:19 +01:00 committed by Michel Dänzer
parent c901adc327
commit 6ef025a872

View File

@ -293,13 +293,12 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
size_t i, size = bits->width * bits->height;
for (i = 0; i < size; i++) {
CARD32 a = argb[i] >> 24;
if (argb[i] > (a << 24 | a << 16 | a << 8 | a)) {
if ((argb[i] & 0xff000000) == 0 && (argb[i] & 0xffffff) != 0) {
/* ARGB data doesn't seem pre-multiplied, fix it */
for (i = 0; i < size; i++) {
CARD32 ar, ag, ab;
CARD32 a, ar, ag, ab;
a = argb[i] >> 24;
ar = a * ((argb[i] >> 16) & 0xff) / 0xff;
ag = a * ((argb[i] >> 8) & 0xff) / 0xff;
ab = a * (argb[i] & 0xff) / 0xff;