Fix out of range color in blend modes
Result of Exclusion and Pin Light blend modes could be greater than 255 which caused artifacts. Limit color value to 0-255 range.
This commit is contained in:
parent
d3ad04172d
commit
9c85acf61d
Notes:
blender-bot
2023-05-29 09:17:12 +02:00
Referenced by issue #75844, Blend modes are broken
|
@ -382,7 +382,7 @@ MINLINE void blend_color_pinlight_byte(uchar dst[4], const uchar src1[4], const
|
|||
else {
|
||||
temp = min_ii(2 * src2[i], src1[i]);
|
||||
}
|
||||
dst[i] = (uchar)((temp * fac + src1[i] * mfac) / 255);
|
||||
dst[i] = (uchar)((min_ii(temp, 255) * fac + src1[i] * mfac) / 255);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -473,7 +473,7 @@ MINLINE void blend_color_exclusion_byte(uchar dst[4], const uchar src1[4], const
|
|||
int i = 3;
|
||||
|
||||
while (i--) {
|
||||
const int temp = 127 - ((2 * (src1[i] - 127) * (src2[i] - 127)) / 255);
|
||||
const int temp = 127 - min_ii(((2 * (src1[i] - 127) * (src2[i] - 127)) / 255), 127);
|
||||
dst[i] = (uchar)((temp * fac + src1[i] * mfac) / 255);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue