winex11: Don't use ColorShifts for non-TrueColor bitmaps.
authorRoderick Colenbrander <thunderbird2k@gmail.com>
Thu, 10 Sep 2009 14:00:00 +0000 (16:00 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 25 Sep 2009 11:16:56 +0000 (13:16 +0200)
dlls/winex11.drv/bitmap.c
dlls/winex11.drv/dib.c
dlls/winex11.drv/x11drv.h

index fee2dbc8620e40442431283b7047c686f3283cc5..47d2562a5075f6ffcee89b68f50aa905f5809117 100644 (file)
@@ -102,6 +102,7 @@ HBITMAP CDECL X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
 
     physDev->bitmap = physBitmap;
     physDev->drawable = physBitmap->pixmap;
+    physDev->color_shifts = physBitmap->trueColor ? &physBitmap->pixmap_color_shifts : NULL;
     SetRect( &physDev->drawable_rect, 0, 0, bitmap.bmWidth, bitmap.bmHeight );
     physDev->dc_rect = physDev->drawable_rect;
 
@@ -119,11 +120,6 @@ HBITMAP CDECL X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
         wine_tsx11_unlock();
     }
 
-    if(physDev->depth == 1)
-        physDev->color_shifts = NULL;
-    else
-        physDev->color_shifts = &physBitmap->pixmap_color_shifts;
-
     return hbitmap;
 }
 
@@ -167,11 +163,13 @@ BOOL CDECL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID
     if(bitmap.bmBitsPixel == 1)
     {
         physBitmap->pixmap_depth = 1;
+        physBitmap->trueColor = FALSE;
     }
     else
     {
         physBitmap->pixmap_depth = screen_depth;
         physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
+        physBitmap->trueColor = (visual->class == TrueColor || visual->class == DirectColor);
     }
     physBitmap->pixmap = XCreatePixmap(gdi_display, root_window,
                                        bitmap.bmWidth, bitmap.bmHeight, physBitmap->pixmap_depth);
index 0bf2548df582cb76f49dbbc334d58af7cd249c10..4b15569f7a845507c3bc837cc3015f735aaa29fb 100644 (file)
@@ -4749,11 +4749,13 @@ HBITMAP CDECL X11DRV_CreateDIBSection( X11DRV_PDEVICE *physDev, HBITMAP hbitmap,
     if(dib.dsBm.bmBitsPixel == 1)
     {
         physBitmap->pixmap_depth = 1;
+        physBitmap->trueColor = FALSE;
     }
     else
     {
         physBitmap->pixmap_depth = screen_depth;
         physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
+        physBitmap->trueColor = (visual->class == TrueColor || visual->class == DirectColor);
     }
 #ifdef HAVE_LIBXXSHM
     physBitmap->shminfo.shmid = -1;
index 62b0d6390c91551138b981ff24662e333e887072..e97bbea6c763de12e954a5f0f771a0d72b701a55 100644 (file)
@@ -124,6 +124,7 @@ typedef struct
     XImage      *image;             /* cached XImage */
     int         *colorMap;          /* color map info */
     int          nColorMap;
+    BOOL         trueColor;
     CRITICAL_SECTION lock;          /* GDI access lock */
     enum x11drv_shm_mode shm_mode;
 #ifdef HAVE_LIBXXSHM