mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
emu/rendlay.cpp: Keep alpha channel intact when drawing text components. (#11820)
Improves appearance of text drawn over colors other than black.
This commit is contained in:
parent
d2e8df2916
commit
c7f9676add
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user