The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Ashley on May 28, 2014, 09:43:47 PM

Title: Glowing blue edges around water?
Post by: Ashley on May 28, 2014, 09:43:47 PM
See screenshot, are the edges of the water supposed to look like that? This is with the 120.0 (r7175) code, albeit running via Cocoa on OSX (so it may well be my code which is at fault here).

(http://entropy.me.uk/simutrans/simscr003.png)
Title: Re: Glowing blue edges around water?
Post by: Ters on May 28, 2014, 10:29:48 PM
My Simutrans has never done that. (Although it has done lots of other crazy things when I mess with it.) The general shape of the coast looks right, but not the colors. I guess the rest of the answers are up to you, since you know what you've done with Simutrans.
Title: Re: Glowing blue edges around water?
Post by: TurfIt on May 28, 2014, 11:00:45 PM
IIRC SDL2 did that with the RGB555 format. Changing to RGB565 fixed.
Title: Re: Glowing blue edges around water?
Post by: Ashley on May 28, 2014, 11:46:20 PM
Quartz doesn't support RGB565 format, I've been using RGB1555 (same code for get_system_color() as simsys_w with USE_16BIT_DIB undefined). It looks likely that none of the other backends actively use RGB1555 though. I suspect that there's a bug in simgraph16 in the routines which are drawing the pixel values for the blended textures making up the shorelines - maybe it's assuming RGB565 format or something like that and it hasn't been spotted since the platforms being compiled for don't use it.


unsigned int get_system_color(unsigned int r, unsigned int g, unsigned int b)
{
    // RGB1555
return ((r & 0x00F8) << 7) | ((g & 0x00F8) << 2) | (b >> 3);
}
Title: Re: Glowing blue edges around water?
Post by: TurfIt on May 28, 2014, 11:57:43 PM
Also IIRC, the '//find out bit depth' code in simgraph_init() didn't work when RGB555 was selected. Forcing the 15bpp routines worked, but just using 565 did too...
Title: Re: Glowing blue edges around water?
Post by: Ashley on May 29, 2014, 12:51:23 AM
Yep, as I thought, a little bug in simgraph16, only applying to the pix_alpha_* and pix_alpha_recode_* functions when ALPHA_BLUE is used in the flags (which is only used for tiles which blend with water, so the coast tiles). Thanks for pointing me in the right direction though :)
Title: Re: Glowing blue edges around water?
Post by: prissi on June 04, 2014, 08:55:53 PM
Thank you for the fix.