wine/dlls/x11drv dib.c

Alexandre Julliard julliard at wine.codeweavers.com
Thu Dec 1 11:15:21 CST 2005


ChangeSet ID:	21602
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/12/01 11:15:21

Modified files:
	dlls/x11drv    : dib.c 

Log message:
	Oldrich Jedlicka <oldium.pro at seznam.cz>
	Fix for the monochrome DIB with inverted colors.

Patch: http://cvs.winehq.org/patch.py?id=21602

Old revision  New revision  Changes     Path
 1.46          1.47          +10 -3      wine/dlls/x11drv/dib.c

Index: wine/dlls/x11drv/dib.c
diff -u -p wine/dlls/x11drv/dib.c:1.46 wine/dlls/x11drv/dib.c:1.47
--- wine/dlls/x11drv/dib.c:1.46	1 Dec 2005 17:15:21 -0000
+++ wine/dlls/x11drv/dib.c	1 Dec 2005 17:15:21 -0000
@@ -896,19 +896,26 @@ static void X11DRV_DIB_GetImageBits_1( i
     notsupported:
         {
             BYTE* dstbyte;
+            BYTE neg = 0;
             unsigned long white = (1 << bmpImage->bits_per_pixel) - 1;
 
             /* ==== any bmp format -> pal 1 dib ==== */
-            WARN("from unknown %d bit bitmap (%lx,%lx,%lx) to 1 bit DIB\n",
+            if ((unsigned)colors[0].rgbRed+colors[0].rgbGreen+colors[0].rgbBlue >=
+                (unsigned)colors[1].rgbRed+colors[1].rgbGreen+colors[1].rgbBlue )
+                neg = 1;
+
+            WARN("from unknown %d bit bitmap (%lx,%lx,%lx) to 1 bit DIB, "
+                 "%s color mapping\n",
                   bmpImage->bits_per_pixel, bmpImage->red_mask,
-                  bmpImage->green_mask, bmpImage->blue_mask );
+                  bmpImage->green_mask, bmpImage->blue_mask,
+                  neg?"negative":"direct" );
 
             for (h=lines-1; h>=0; h--) {
                 BYTE dstval;
                 dstbyte=dstbits;
                 dstval=0;
                 for (x=0; x<width; x++) {
-                    dstval|=(XGetPixel( bmpImage, x, h) >= white) << (7 - (x&7));
+                    dstval|=((XGetPixel( bmpImage, x, h) >= white) ^ neg) << (7 - (x&7));
                     if ((x&7)==7) {
                         *dstbyte++=dstval;
                         dstval=0;



More information about the wine-cvs mailing list