Hi again,

I did not find the problem, but I found different solution - for 
consideration:

There is problem that with pixmap_depth we loose the color information - there 
can be workaround found for this (what I suggested in the second patch). I 
removed now all the pixmap_depth stuff (just to test it) and received what I 
expected - tests are running correctly (and some todos passed) and the game 
Neighbours from Hell is also working correctly - I know that this doesn't 
mean that it is the correct way to do it.

So there are two ways:
* Find a solution with monochrome bitmaps
* Change monochrome bitmaps to use pixmap_depth=screen as other DIBs

Any hint - which way to go? I think I do not have time during the weekend, so 
I will probably look at it next week on Monday.

Used patch for "colored" monochrome bitmaps is attached.

Cheers,

  Oldrich.

Dne Thursday 01 of December 2005 18:37 Alexandre Julliard napsal(a):
> Oldrich Jedlicka <[EMAIL PROTECTED]> writes:
> > This fixes colors in monochrome bitmaps that were overwritten by identity
> > colormap every time.
> >
> > Changelog:
> >
> > * Remove the identity color map overwriting on all monochrome bitmaps
>
> This breaks the tests:
>
> bitmap.c:399: Test failed: lower left pixel is 00ff00ff
> bitmap.c:400: Test failed: bottom but one, left pixel is 0000ff00
Index: dlls/x11drv/dib.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/dib.c,v
retrieving revision 1.47
diff -u -r1.47 dib.c
--- dlls/x11drv/dib.c	1 Dec 2005 17:15:21 -0000	1.47
+++ dlls/x11drv/dib.c	2 Dec 2005 08:22:08 -0000
@@ -290,29 +290,19 @@
         {
             const RGBQUAD * rgb = (const RGBQUAD *)colorPtr;
 
-            if (depth == 1)  /* Monochrome */
-                for (i = start; i < end; i++, rgb++)
-                    colorMapping[i] = (rgb->rgbRed + rgb->rgbGreen +
-                                       rgb->rgbBlue > 255*3/2);
-            else
-                for (i = start; i < end; i++, rgb++)
-                    colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, RGB(rgb->rgbRed,
-                                                                rgb->rgbGreen,
-                                                                rgb->rgbBlue));
+            for (i = start; i < end; i++, rgb++)
+                colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, RGB(rgb->rgbRed,
+                                                            rgb->rgbGreen,
+                                                            rgb->rgbBlue));
         }
         else
         {
             const RGBTRIPLE * rgb = (const RGBTRIPLE *)colorPtr;
 
-            if (depth == 1)  /* Monochrome */
-                for (i = start; i < end; i++, rgb++)
-                    colorMapping[i] = (rgb->rgbtRed + rgb->rgbtGreen +
-                                       rgb->rgbtBlue > 255*3/2);
-            else
-                for (i = start; i < end; i++, rgb++)
-                    colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, RGB(rgb->rgbtRed,
-                                                               rgb->rgbtGreen,
-                                                               rgb->rgbtBlue));
+            for (i = start; i < end; i++, rgb++)
+                colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, RGB(rgb->rgbtRed,
+                                                           rgb->rgbtGreen,
+                                                           rgb->rgbtBlue));
         }
     }
     else  /* DIB_PAL_COLORS */
@@ -896,26 +885,19 @@
     notsupported:
         {
             BYTE* dstbyte;
-            BYTE neg = 0;
             unsigned long white = (1 << bmpImage->bits_per_pixel) - 1;
 
             /* ==== any bmp format -> pal 1 dib ==== */
-            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",
+            WARN("from unknown %d bit bitmap (%lx,%lx,%lx) to 1 bit DIB\n",
                   bmpImage->bits_per_pixel, bmpImage->red_mask,
-                  bmpImage->green_mask, bmpImage->blue_mask,
-                  neg?"negative":"direct" );
+                  bmpImage->green_mask, bmpImage->blue_mask);
 
             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) ^ neg) << (7 - (x&7));
+                    dstval|=(XGetPixel( bmpImage, x, h) >= white) << (7 - (x&7));
                     if ((x&7)==7) {
                         *dstbyte++=dstval;
                         dstval=0;
@@ -4159,7 +4141,6 @@
 {
   DIBSECTION dibSection;
   X11DRV_DIB_IMAGEBITS_DESCR descr;
-  int identity[2] = {0,1};
 
   if (!GetObjectW( physBitmap->hbitmap, sizeof(dibSection), &dibSection )) return;
 
@@ -4175,9 +4156,6 @@
   descr.depth     = physBitmap->pixmap_depth;
   descr.compression = dibSection.dsBmih.biCompression;
 
-  if(descr.infoBpp == 1)
-      descr.colorMap = (void*)identity;
-
   switch (descr.infoBpp)
   {
     case 1:
@@ -4645,7 +4623,7 @@
 
     /* create pixmap and X image */
     wine_tsx11_lock();
-    physBitmap->pixmap_depth = (dib.dsBm.bmBitsPixel == 1) ? 1 : screen_depth;
+    physBitmap->pixmap_depth = screen_depth;
     physBitmap->pixmap = XCreatePixmap( gdi_display, root_window, dib.dsBm.bmWidth,
                                         dib.dsBm.bmHeight, physBitmap->pixmap_depth );
 #ifdef HAVE_LIBXXSHM


Reply via email to