Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
08226 Core Minor Always Feb 21, 2022, 12:52 Feb 28, 2022, 12:29
Tester hap View Status Public Platform
Assigned To hap Resolution Fixed OS
Status [?] Resolved Driver
Version 0.240 Fixed in Version 0.242 Build
Fixed in Git Commit fba39f5 Github Pull Request #
Summary 08226: artwork: Color overflow on disk element with some value of alpha
Description It appears color channels may overflow depending on its color alpha value when using the disk element in internal artwork. See screenshot and .lay file example.
Steps To Reproduce copy merlin.zip to artwork folder
mame.exe merlin
Additional Information
Github Commit
Flags
Regression Version
Affected Sets / Systems
Attached Files
zip file icon merlin.zip (438 bytes) Feb 21, 2022, 12:52 Uploaded by hap
png file icon blue_disk.png (31,904 bytes) Feb 21, 2022, 12:53 Uploaded by hap
hap
Relationships
There are no relationship linked to this issue.
Notes
1
User avatar
No.19860
hap
Developer
Feb 28, 2022, 10:30
class layout_element::disk_component
draw(running_machine &machine, bitmap_argb32 &dest, int state) override

u32 const a(c.a * 255.0F);
0.5*255 = 127.5
round down to 127

u32 const r(c.r * c.a * (255.0F * 255.0F * 255.0F));
1.0*0.5*255*255*255 = 8290687.5
round down to 8290687, hex = 0x7E817F

u32 const inva(255 - a);
128

rendlay.cpp inline void alpha_blend(u32 &dest, u32 a, u32 r, u32 g, u32 b, u32 inva)
u32 const finala((a * 255) + (da * inva));
127*255 + 0*128 = 32385, hex = 0x7E81

if ((finalr / finala)>255) printf("%X = %X / %X -- %X %X %X\n",(finalr / finala), finalr, finala, a, inva, r);

says:
100 = 7E817F / 7E81 -- 7F 80 7E817F

palette.h rgb_t(u8, u8, u8, u8) gets a 0x100 in one of the colors and truncates to 0
thus red is gone in the merlin.lay example