x11drv: question about byte-swapping for DIBs
I'm trying to debug a problem in which 24-bit .bmps don't display correctly from a winelib application on a big-endian sparc host when displaying on a little-endian intel PC. In this case, the image is garbled, with most of the colors being wrong and a pattern of vertical stripes over the image. The code passes through convert_888_to_0888_reverse_dst_byteswap which is what mangles the image data. I looked through the other conversion functions, and it seems the corresponding 'src' function (convert_888_to_0888_reverse_src_byteswap) actually does the correct transformation. I don't have a very good grasp of why the conversions are chosen, but it seemed like a likely fix would be to edit dib.c and make the lines in the SetImageBits functions that select the conversion structure look like: #ifdef WORDS_BIGENDIAN const dib_conversions *convs = (bmpImage->byte_order == LSBFirst) ? &dib_normal : &dib_src_byteswap; #else const dib_conversions *convs = (bmpImage->byte_order == LSBFirst) ? &dib_normal : &dib_dst_byteswap; #endif Doing this fixed my problem and didn't seem to cause any others, but I'm wondering whether this fix is correct or if I just got lucky. Can someone who knows this code tell me if this makes logical sense? (If it's correct, there probably needs to be a related patch in the GetImageBits functions, just going in the other direction). Eric
On Wed, 19 Apr 2006 16:50:47 -0400 Eric Frias <efrias(a)syncad.com> wrote:
I'm trying to debug a problem in which 24-bit .bmps don't display correctly from a winelib application on a big-endian sparc host when displaying on a little-endian intel PC. In this case, the image is garbled, with most of the colors being wrong and a pattern of vertical stripes over the image. The code passes through convert_888_to_0888_reverse_dst_byteswap which is what mangles the image data.
Just my 2 cents: the same bug appears in a winelib app on a big-endian PowerPC host when displaying on the same big-endian PowerPC host, so it's probably independent of display host. -- Ph.
Am Mittwoch, 19. April 2006 22:50 schrieb Eric Frias:
I'm trying to debug a problem in which 24-bit .bmps don't display correctly from a winelib application on a big-endian sparc host when displaying on a little-endian intel PC. In this case, the image is garbled, with most of the colors being wrong and a pattern of vertical stripes over the image. The code passes through convert_888_to_0888_reverse_dst_byteswap which is what mangles the image data.
Messed colors and vertical stripes? Similar to http://www.froq.net/mirage/mirage1.png ? That's a standard Windows application running with regular Wine on x86, no Winelib or any endianess issues involved - in case the problem you see is similar... -- Willie Sippel //////// | Tritium Studios // | ______________________________ //// /// | http://www.tritium-studios.com <willie(a)froq.net>
On Thu, 20 Apr 2006 00:10:42 +0200 Willie Sippel <willie(a)zeitgeistmedia.net> wrote:
Am Mittwoch, 19. April 2006 22:50 schrieb Eric Frias:
I'm trying to debug a problem in which 24-bit .bmps don't display correctly from a winelib application on a big-endian sparc host when displaying on a little-endian intel PC. In this case, the image is garbled, with most of the colors being wrong and a pattern of vertical stripes over the image. The code passes through convert_888_to_0888_reverse_dst_byteswap which is what mangles the image data.
Messed colors and vertical stripes? Similar to http://www.froq.net/mirage/mirage1.png ?
No, I get rather like this: http://newstar.rinet.ru/~phil/Screenshot-StarLing-for-Macintosh.png (the yellow-greenish square buttons should be light grey and clear) -- Ph.
Phil Krylov wrote:
Messed colors and vertical stripes? Similar to http://www.froq.net/mirage/mirage1.png ?
No, I get rather like this:
http://newstar.rinet.ru/~phil/Screenshot-StarLing-for-Macintosh.png
The StarLing image may be similar, but I think you're both looking at different bugs than I am... Here's the bitmap I see: http://www.syncad.com/wine-devel/striped-bitmap.jpg a closeup of one of the hands in the image to show the stripes: http://www.syncad.com/wine-devel/striped-bitmap-closeup.jpg here's the bitmap file I'm using: http://www.syncad.com/wine-devel/Sample.bmp I've just been testing it by replacing replacing programs/winecfg/idb_wine.bmp with Sample.bmp, the image will be displayed on the 'About' tab. Eric
participants (3)
-
Eric Frias -
Phil Krylov -
Willie Sippel