leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
275 stars 52 forks source link

[Bug] Some parts of legacy 2D panels not rendering correctly #1042

Open hotdamndel opened 4 months ago

hotdamndel commented 4 months ago

First, an odd blank white image which appears rarely with some trains. Train is 10-300 series from https://1drv.ms/u/s!AhCaPh_sbBw9fpYdBQthA4_S39w panel1

In some panels, big images just don't render at all (try 415 series from Rock_on's BVE5 JNR pack for example) or when # is missing in Color in a Needle indicator in Panel2.cfg (as per BVE5 standard), arrows become blue.

leezer3 commented 4 months ago

Now, that's really interesting.

Our offending file is an 8-bit palletised BMPv2, with a declared total of 252 colors. Looking into the color table, the off-white pixels we're seeing are using the color with the index of 253, which is outside of our color table.

If we open this file with Paint or anything using the GDI+ decoder, we get the black background. However, opening this file with GIMP2, Photoshop or a bunch of other non GDI+ decoders gives a white background.

Basically, mapping to a color outside of the color table is undefined behaviour on behalf of whatever created the file in the first place. For the next build, I'm mapping to black if hacks are enabled.