nitpicker: avoid color bleeding

This patch improves the output of opaque pixels in the presence of an
alpha channel by adding a special case for the maximum alpha value.

Fixes #2831
This commit is contained in:
Norman Feske 2019-01-03 15:13:40 +01:00
parent 97bfc13237
commit 76e96e92cb

View File

@ -98,9 +98,11 @@ struct Texture_painter
* Copy texture with alpha blending * Copy texture with alpha blending
*/ */
for (j = clipped.h(); j--; src += src_w, alpha += src_w, dst += dst_w) for (j = clipped.h(); j--; src += src_w, alpha += src_w, dst += dst_w)
for (i = clipped.w(), s = src, a = alpha, d = dst; i--; s++, d++, a++) for (i = clipped.w(), s = src, a = alpha, d = dst; i--; s++, d++, a++) {
if (*a) unsigned char const alpha_value = *a;
*d = PT::mix(*d, *s, *a); if (__builtin_expect(alpha_value != 0, true))
*d = PT::mix(*d, *s, alpha_value + 1);
}
break; break;
case MIXED: case MIXED: