scummvm/scummvm — pull request #486 by Akz- (2014-08-01 21:46:46+00:00)
Title: GRAPHICS: Fix conversion from 1-bit to 8-bit alpha in colorToARGB.

The colorToARGB method in PixelFormat has an issue if the pixel format specifies a 1-bit alpha channel.

The naive (but fast) method used for mapping the color channels to the 8-bit value range darkens the color a bit in the process. This is especially noticeable with a 1-bit alpha channel. A 1-bit alpha value 1 is mapped to the 8-bit value 128, so the resulting color will be half transparent.

This PR adds special handling for the 1-bit alpha case, so the returned color will either be fully transparent or fully opaque depending on the value of the alpha bit.

We encountered the issue in ResidualVM with Escape from Monkey Island where we need to convert pixel buffers in 1555 pixel format to RGBA. If any future ScummVM engines attempt to do something similar, this fix may save the devs some headache.