Some new DIB conversion routines
Lionel Ulmer
lionel.ulmer at free.fr
Mon Feb 12 16:42:48 CST 2001
Hi all,
While running Grim Fandango (again) on a 32bpp X server, the colors where
all funky (yes, I know, the main character's buddy is already orange in the
original version and it's not a Wine bug).
So I tracked it to some conversion missing in the DIB code (ie the RGB 565
=> RGB 32 conversion).
Changelog
- add RGB 565 => RGB 0888 conversion
Lionel
-------------- next part --------------
Index: wine/graphics/x11drv/dib.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/dib.c,v
retrieving revision 1.70
diff -u -r1.70 dib.c
--- wine/graphics/x11drv/dib.c 2001/02/12 01:20:30 1.70
+++ wine/graphics/x11drv/dib.c 2001/02/12 22:31:56
@@ -1482,21 +1482,35 @@
LPWORD ptr = (LPWORD)srcbits + left;
DWORD val;
- /* ==== 555 BGR dib to 24/32 BGR bitmap ==== */
if (bmpImage->red_mask == 0xff0000 && bmpImage->blue_mask == 0xff)
{
- for (h = lines - 1; h >= 0; h--) {
- dstpixel = (DWORD *) (bmpImage->data + h * bmpImage->bytes_per_line + left*4);
- for (x = 0; x < dstwidth; x++) {
-
+ if ((rSrc == 0xF800) && (gSrc == 0x07E0) && (bSrc == 0x001F)) {
+ /* ==== 555 RGB dib to 24/32 RGB bitmap ==== */
+ for (h = lines - 1; h >= 0; h--) {
+ dstpixel = (DWORD *) (bmpImage->data + h * bmpImage->bytes_per_line + left*4);
+ for (x = 0; x < dstwidth; x++) {
val = *ptr++;
+ *dstpixel++ = ((val << 8) & 0xF80000) | /* Red */
+ ((val << 5) & 0x00FC00) | /* Green */
+ ((val << 3) & 0x0000FF); /* Blue */
+ }
+ ptr = (LPWORD)(srcbits += linebytes) + left;
+ }
+ } else {
+ /* ==== 555 BGR dib to 24/32 BGR bitmap ==== */
+ for (h = lines - 1; h >= 0; h--) {
+ dstpixel = (DWORD *) (bmpImage->data + h * bmpImage->bytes_per_line + left*4);
+ for (x = 0; x < dstwidth; x++) {
+
+ val = *ptr++;
*dstpixel++ = ((val << 9) & 0xf80000) | ((val << 4) & 0x070000) | /* Red */
((val << 6) & 0x00f800) | ((val << 1) & 0x000700) | /* Green */
((val << 3) & 0x0000f8) | ((val >> 2) & 0x000007); /* Blue */
- }
- ptr = (LPWORD)(srcbits += linebytes) + left;
- }
- }
+ }
+ ptr = (LPWORD)(srcbits += linebytes) + left;
+ }
+ }
+ }
/* ==== 555 BGR dib to 24/32 RGB bitmap ==== */
else if (bmpImage->red_mask == 0xff && bmpImage->blue_mask == 0xff0000)
{
More information about the wine-patches
mailing list