From 6a5d2f4ea2261528ae9d15c66852635b05743d97 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 27 Oct 2020 13:20:50 +0100 Subject: Fix blend_color_interpolate_byte returning wrong alpha in certain case When the combined alpha [the 'tmp' variable having the mixfactor applied already] - reached zero it was handled like a no-op (for the alpha as well) and just copied the first color. So e.g mixing 255/255/255/255 with 0/0/0/0 with a factor of 1.0 gave alpha of 255, which looks wrong. cases where tmp gets zero: src1 alpha:0 src2 alpha:whatever mixfactor 0.0 src1 alpha:whatever src2 alpha:0 mixfactor 1.0 src1 alpha:0 src2 alpha:0 mixfactor whatever Now set alpha to zero in that case. ref T81914 Maniphest Tasks: T81914 Differential Revision: https://developer.blender.org/D9357 --- source/blender/blenlib/intern/math_color_blend_inline.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenlib/intern/math_color_blend_inline.c') diff --git a/source/blender/blenlib/intern/math_color_blend_inline.c b/source/blender/blenlib/intern/math_color_blend_inline.c index eb82bb81a89..7ad4f0d9585 100644 --- a/source/blender/blenlib/intern/math_color_blend_inline.c +++ b/source/blender/blenlib/intern/math_color_blend_inline.c @@ -606,6 +606,7 @@ MINLINE void blend_color_interpolate_byte(uchar dst[4], } else { copy_v4_v4_uchar(dst, src1); + dst[3] = 0; } } -- cgit v1.2.3