Roderick Colenbrander : winex11: Don' t use ColorShifts for non-TrueColor bitmaps.

Alexandre Julliard julliard at winehq.org
Fri Sep 25 10:24:55 CDT 2009


Module: wine
Branch: master
Commit: 94657000835c1caf3cf0299b6103fb1e1068c1ad
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=94657000835c1caf3cf0299b6103fb1e1068c1ad

Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date:   Thu Sep 10 16:00:00 2009 +0200

winex11: Don't use ColorShifts for non-TrueColor bitmaps.

---

 dlls/winex11.drv/bitmap.c |    8 +++-----
 dlls/winex11.drv/dib.c    |    2 ++
 dlls/winex11.drv/x11drv.h |    1 +
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/winex11.drv/bitmap.c b/dlls/winex11.drv/bitmap.c
index fee2dbc..47d2562 100644
--- a/dlls/winex11.drv/bitmap.c
+++ b/dlls/winex11.drv/bitmap.c
@@ -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);
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 0bf2548..4b15569 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -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;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 62b0d63..e97bbea 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -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




More information about the wine-cvs mailing list