Roderick Colenbrander : winex11: Use ColorShifts from physDev in X11DRV_PALETTE_ToPhysical.

Alexandre Julliard julliard at winehq.org
Wed Sep 2 09:31:37 CDT 2009


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

Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date:   Tue Sep  1 21:48:29 2009 +0200

winex11: Use ColorShifts from physDev in X11DRV_PALETTE_ToPhysical.

---

 dlls/winex11.drv/bitmap.c  |   14 +++++++++++++-
 dlls/winex11.drv/dib.c     |   10 +++++++++-
 dlls/winex11.drv/init.c    |    2 ++
 dlls/winex11.drv/palette.c |    5 ++++-
 dlls/winex11.drv/x11drv.h  |    3 +++
 5 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/dlls/winex11.drv/bitmap.c b/dlls/winex11.drv/bitmap.c
index a288352..4d635aa 100644
--- a/dlls/winex11.drv/bitmap.c
+++ b/dlls/winex11.drv/bitmap.c
@@ -110,6 +110,10 @@ HBITMAP CDECL X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
     if (physDev->depth != physBitmap->pixmap_depth)
     {
         physDev->depth = physBitmap->pixmap_depth;
+        if(physDev->depth == 1)
+            physDev->color_shifts = NULL;
+        else
+            physDev->color_shifts = &physBitmap->pixmap_color_shifts;
         wine_tsx11_lock();
         XFreeGC( gdi_display, physDev->gc );
         physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL );
@@ -158,7 +162,15 @@ BOOL CDECL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID
 
       /* Create the pixmap */
     wine_tsx11_lock();
-    physBitmap->pixmap_depth = (bitmap.bmBitsPixel == 1) ? 1 : screen_depth;
+    if(bitmap.bmBitsPixel == 1)
+    {
+        physBitmap->pixmap_depth = 1;
+    }
+    else
+    {
+        physBitmap->pixmap_depth = screen_depth;
+        physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
+    }
     physBitmap->pixmap = XCreatePixmap(gdi_display, root_window,
                                        bitmap.bmWidth, bitmap.bmHeight, physBitmap->pixmap_depth);
     wine_tsx11_unlock();
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index b40215a..8a61332 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -4746,7 +4746,15 @@ HBITMAP CDECL X11DRV_CreateDIBSection( X11DRV_PDEVICE *physDev, HBITMAP hbitmap,
 
     /* create pixmap and X image */
     wine_tsx11_lock();
-    physBitmap->pixmap_depth = (dib.dsBm.bmBitsPixel == 1) ? 1 : screen_depth;
+    if(dib.dsBm.bmBitsPixel == 1)
+    {
+        physBitmap->pixmap_depth = 1;
+    }
+    else
+    {
+        physBitmap->pixmap_depth = screen_depth;
+        physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
+    }
 #ifdef HAVE_LIBXXSHM
     physBitmap->shminfo.shmid = -1;
 
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 480486f..ba6cc51 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -138,6 +138,7 @@ BOOL CDECL X11DRV_CreateDC( HDC hdc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCW
         physDev->bitmap    = &BITMAP_stock_phys_bitmap;
         physDev->drawable  = BITMAP_stock_phys_bitmap.pixmap;
         physDev->depth     = 1;
+        physDev->color_shifts = NULL;
         SetRect( &physDev->drawable_rect, 0, 0, 1, 1 );
         physDev->dc_rect = physDev->drawable_rect;
     }
@@ -146,6 +147,7 @@ BOOL CDECL X11DRV_CreateDC( HDC hdc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCW
         physDev->bitmap    = NULL;
         physDev->drawable  = root_window;
         physDev->depth     = screen_depth;
+        physDev->color_shifts = &X11DRV_PALETTE_default_shifts;
         physDev->drawable_rect = virtual_screen_rect;
         SetRect( &physDev->dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
                  virtual_screen_rect.bottom - virtual_screen_rect.top );
diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c
index d934b65..bf2cee8 100644
--- a/dlls/winex11.drv/palette.c
+++ b/dlls/winex11.drv/palette.c
@@ -60,7 +60,7 @@ Colormap X11DRV_PALETTE_PaletteXColormap = 0;
 UINT16   X11DRV_PALETTE_PaletteFlags     = 0;
 
 /* initialize to zero to handle abortive X11DRV_PALETTE_VIRTUAL visuals */
-static ColorShifts X11DRV_PALETTE_default_shifts = { {0,0,0,}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} };
+ColorShifts X11DRV_PALETTE_default_shifts = { {0,0,0,}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} };
 static int X11DRV_PALETTE_Graymax        = 0;
 
 static int palette_size;
@@ -874,6 +874,9 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
     PALETTEENTRY entry;
     ColorShifts *shifts = &X11DRV_PALETTE_default_shifts;
 
+    if(physDev->color_shifts)
+        shifts = physDev->color_shifts;
+
     if ( X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_FIXED )
     {
         /* there is no colormap limitation; we are going to have to compute
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index e879c4c..828eebe 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -118,6 +118,7 @@ typedef struct
     Pixmap       pixmap;
     XID          glxpixmap;
     int          pixmap_depth;
+    ColorShifts  pixmap_color_shifts;
     /* the following fields are only used for DIB section bitmaps */
     int          status, p_status;  /* mapping status */
     XImage      *image;             /* cached XImage */
@@ -155,6 +156,7 @@ typedef struct
     int           backgroundPixel;
     int           textPixel;
     int           depth;       /* bit depth of the DC */
+    ColorShifts  *color_shifts; /* color shifts of the DC */
     int           exposures;   /* count of graphics exposures operations */
     int           current_pf;
     Drawable      gl_drawable;
@@ -480,6 +482,7 @@ extern UINT16 X11DRV_PALETTE_PaletteFlags;
 
 extern int *X11DRV_PALETTE_PaletteToXPixel;
 extern int *X11DRV_PALETTE_XPixelToPalette;
+extern ColorShifts X11DRV_PALETTE_default_shifts;
 
 extern int X11DRV_PALETTE_mapEGAPixel[16];
 




More information about the wine-cvs mailing list