From c7f9676add672a605b45130662858223fa336d9d Mon Sep 17 00:00:00 2001 From: Devin Acker Date: Wed, 6 Dec 2023 12:29:57 -0500 Subject: [PATCH] emu/rendlay.cpp: Keep alpha channel intact when drawing text components. (#11820) Improves appearance of text drawn over colors other than black. --- src/emu/rendlay.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index d320999bd96..a447fffec64 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -3727,12 +3727,6 @@ void layout_element::component::draw_text( int align, const render_color &color) { - // compute premultiplied color - u32 const r(color.r * 255.0f); - u32 const g(color.g * 255.0f); - u32 const b(color.b * 255.0f); - u32 const a(color.a * 255.0f); - // get the width of the string float aspect = 1.0f; s32 width; @@ -3797,12 +3791,7 @@ void layout_element::component::draw_text( u32 spix = rgb_t(src[x]).a(); if (spix != 0) { - rgb_t dpix = d[effx]; - u32 ta = (a * (spix + 1)) >> 8; - u32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; - u32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; - u32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; - d[effx] = rgb_t(tr, tg, tb); + alpha_blend(d[effx], color, spix / 255.0); } } }