On Fri, 11 May 2007 15:37:27 +0100 Simon Farnsworth
> We've found that loader_bmp.c in imlib2 1.4.0 does not correctly handle
> RGB565 Windows BMPs (compression method BI_BITFIELDS), nor does it
> correctly shift the bits for RGB555 images into the MSBs of the 32 bit
> output format.
> The attached patch corrects loader_bmp.c's handling of 16 bit Windows
> BMPs by doing the following:
> * Introduce a left shift for each of the three colour components in
> 16-bit images
> * Set this left shift to 3 for each colour component in RGB555 images
> * For "bitfields" images (RGB565, for example), determine the value of
> left shift by masking and shifting 0xFFFF until the byte value of the
> component has the MSB set.
> * When reading components, left shift them appropriately, to make the
> byte values the MSBs of the output colour components.
> We've also noticed that 16 bit BMP handling depends on a little-endian
> processor; this is fine for us, so I've not fixed it, but if
> endian-independence is a goal, the code underneath "THIS WAS OLD CODE"
> needs re-evaluating (casting unsigned char * to unsigned short *, then
> deferencing the pix pointer assumes that we're on a little-endian system).
i also fixed endianess - i think. in cvs :)
> I'm not subscribed to the list, so please CC me on any replies.
> Simon Farnsworth
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler) raster@...
Tokyo, Japan (東京 日本)