diff --git a/bemani/format/afp/blend/blend.py b/bemani/format/afp/blend/blend.py index 8465e57..f5990e9 100644 --- a/bemani/format/afp/blend/blend.py +++ b/bemani/format/afp/blend/blend.py @@ -131,12 +131,10 @@ def blend_overlay( # jubeat uses the alternative formula Src * Dst + Dst * (1 - As). # Calculate final color blending. - src_alpha = src[3] / 255.0 - src_remainder = 1.0 - src_alpha return ( - clamp((255 * (2.0 * (dest[0] / 255.0) * (src[0] / 255.0) * src_alpha)) + (dest[0] * src_remainder)), - clamp((255 * (2.0 * (dest[1] / 255.0) * (src[1] / 255.0) * src_alpha)) + (dest[1] * src_remainder)), - clamp((255 * (2.0 * (dest[2] / 255.0) * (src[2] / 255.0) * src_alpha)) + (dest[2] * 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)))), + clamp((255 * (2.0 * (dest[2] / 255.0) * (src[2] / 255.0)))), dest[3], ) diff --git a/bemani/format/afp/blend/blendcppimpl.cxx b/bemani/format/afp/blend/blendcppimpl.cxx index 8d6a8fe..8212c40 100644 --- a/bemani/format/afp/blend/blendcppimpl.cxx +++ b/bemani/format/afp/blend/blendcppimpl.cxx @@ -204,12 +204,10 @@ extern "C" // jubeat uses the alternative formula Src * Dst + Dst * (1 - As). // Calculate final color blending. - double src_alpha = src.a / 255.0; - double src_remainder = 1.0 - src_alpha; 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.g / 255.0) * (src.g / 255.0) * src_alpha)) + (dest.g * src_remainder)), - clamp((255 * (2.0 * (dest.b / 255.0) * (src.b / 255.0) * src_alpha)) + (dest.b * 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)))), + clamp((255 * (2.0 * (dest.b / 255.0) * (src.b / 255.0)))), dest.a, }; }