Alexandre Julliard : winex11: Fix the X image masks according to the pixmap format in Get/SetDIBits.

Alexandre Julliard julliard at winehq.org
Wed Jun 2 11:16:25 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jun  2 15:52:20 2010 +0200

winex11: Fix the X image masks according to the pixmap format in Get/SetDIBits.

---

 dlls/winex11.drv/dib.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index cf58e8b..11157f1 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -71,6 +71,7 @@ typedef struct
     WORD                    depth;
     WORD                    infoBpp;
     WORD                    compression;
+    ColorShifts            *shifts;
     RGBQUAD                *colorMap;
     int                     nColorMap;
     Drawable                drawable;
@@ -3541,6 +3542,12 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
             wine_tsx11_unlock();
             return 0;
         }
+        if (descr->shifts)
+        {
+            bmpImage->red_mask = descr->shifts->physicalRed.max << descr->shifts->physicalRed.shift;
+            bmpImage->green_mask = descr->shifts->physicalGreen.max << descr->shifts->physicalGreen.shift;
+            bmpImage->blue_mask = descr->shifts->physicalBlue.max << descr->shifts->physicalBlue.shift;
+        }
     }
     wine_tsx11_unlock();
 
@@ -3698,6 +3705,12 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
             wine_tsx11_unlock();
             return 0;
         }
+        if (descr->shifts)
+        {
+            bmpImage->red_mask = descr->shifts->physicalRed.max << descr->shifts->physicalRed.shift;
+            bmpImage->green_mask = descr->shifts->physicalGreen.max << descr->shifts->physicalGreen.shift;
+            bmpImage->blue_mask = descr->shifts->physicalBlue.max << descr->shifts->physicalBlue.shift;
+        }
     }
 
 #ifdef HAVE_LIBXXSHM
@@ -3930,6 +3943,7 @@ INT CDECL X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDes
     descr.lines      = top_down ? -lines : lines;
     descr.infoWidth  = width;
     descr.depth      = physDev->depth;
+    descr.shifts     = physDev->color_shifts;
     descr.drawable   = physDev->drawable;
     descr.gc         = physDev->gc;
     descr.xSrc       = xSrc;
@@ -4019,6 +4033,7 @@ INT CDECL X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
   descr.infoWidth  = width;
   descr.lines      = tmpheight >= 0 ? lines : -lines;
   descr.depth      = physBitmap->pixmap_depth;
+  descr.shifts     = physBitmap->trueColor ? &physBitmap->pixmap_color_shifts : NULL;
   descr.drawable   = physBitmap->pixmap;
   descr.gc         = get_bitmap_gc(physBitmap->pixmap_depth);
   descr.xSrc       = 0;
@@ -4175,6 +4190,7 @@ INT CDECL X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
   descr.infoWidth  = width;
   descr.lines      = lines;
   descr.depth      = physBitmap->pixmap_depth;
+  descr.shifts     = physBitmap->trueColor ? &physBitmap->pixmap_color_shifts : NULL;
   descr.drawable   = physBitmap->pixmap;
   descr.gc         = get_bitmap_gc(physBitmap->pixmap_depth);
   descr.width      = dib.dsBm.bmWidth;
@@ -4250,6 +4266,7 @@ static void X11DRV_DIB_DoCopyDIBSection(X_PHYSBITMAP *physBitmap, BOOL toDIB,
   descr.nColorMap   = nColorMap;
   descr.bits        = dibSection.dsBm.bmBits;
   descr.depth       = physBitmap->pixmap_depth;
+  descr.shifts      = physBitmap->trueColor ? &physBitmap->pixmap_color_shifts : NULL;
   descr.compression = dibSection.dsBmih.biCompression;
   descr.physBitmap  = physBitmap;
 




More information about the wine-cvs mailing list