[Bf-blender-cvs] [6a5d2f4ea22] blender-v2.91-release: Fix blend_color_interpolate_byte returning wrong alpha in certain case

Philipp Oeser noreply at git.blender.org
Thu Oct 29 09:44:47 CET 2020


Commit: 6a5d2f4ea2261528ae9d15c66852635b05743d97
Author: Philipp Oeser
Date:   Tue Oct 27 13:20:50 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rB6a5d2f4ea2261528ae9d15c66852635b05743d97

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

===================================================================

M	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;
   }
 }



More information about the Bf-blender-cvs mailing list