Merge overlay blend mode fix from ARCHVILE.
This commit is contained in:
parent
a97df7d24a
commit
2664237026
@ -131,12 +131,10 @@ def blend_overlay(
|
|||||||
# jubeat uses the alternative formula Src * Dst + Dst * (1 - As).
|
# jubeat uses the alternative formula Src * Dst + Dst * (1 - As).
|
||||||
|
|
||||||
# Calculate final color blending.
|
# Calculate final color blending.
|
||||||
src_alpha = src[3] / 255.0
|
|
||||||
src_remainder = 1.0 - src_alpha
|
|
||||||
return (
|
return (
|
||||||
clamp((255 * (2.0 * (dest[0] / 255.0) * (src[0] / 255.0) * src_alpha)) + (dest[0] * src_remainder)),
|
clamp((255 * (2.0 * (dest[0] / 255.0) * (src[0] / 255.0)))),
|
||||||
clamp((255 * (2.0 * (dest[1] / 255.0) * (src[1] / 255.0) * src_alpha)) + (dest[1] * src_remainder)),
|
clamp((255 * (2.0 * (dest[1] / 255.0) * (src[1] / 255.0)))),
|
||||||
clamp((255 * (2.0 * (dest[2] / 255.0) * (src[2] / 255.0) * src_alpha)) + (dest[2] * src_remainder)),
|
clamp((255 * (2.0 * (dest[2] / 255.0) * (src[2] / 255.0)))),
|
||||||
dest[3],
|
dest[3],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -204,12 +204,10 @@ extern "C"
|
|||||||
// jubeat uses the alternative formula Src * Dst + Dst * (1 - As).
|
// jubeat uses the alternative formula Src * Dst + Dst * (1 - As).
|
||||||
|
|
||||||
// Calculate final color blending.
|
// Calculate final color blending.
|
||||||
double src_alpha = src.a / 255.0;
|
|
||||||
double src_remainder = 1.0 - src_alpha;
|
|
||||||
return (intcolor_t){
|
return (intcolor_t){
|
||||||
clamp((255 * (2.0 * (dest.r / 255.0) * (src.r / 255.0) * src_alpha)) + (dest.r * src_remainder)),
|
clamp((255 * (2.0 * (dest.r / 255.0) * (src.r / 255.0)))),
|
||||||
clamp((255 * (2.0 * (dest.g / 255.0) * (src.g / 255.0) * src_alpha)) + (dest.g * src_remainder)),
|
clamp((255 * (2.0 * (dest.g / 255.0) * (src.g / 255.0)))),
|
||||||
clamp((255 * (2.0 * (dest.b / 255.0) * (src.b / 255.0) * src_alpha)) + (dest.b * src_remainder)),
|
clamp((255 * (2.0 * (dest.b / 255.0) * (src.b / 255.0)))),
|
||||||
dest.a,
|
dest.a,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user