dib: GetDIBits with BI_RLE4/8

Huw D M Davies h.davies1 at physics.ox.ac.uk
Tue Mar 30 05:51:51 CST 2004


        Huw Davies <huw at codeweavers.com>
        We don't support GetDIBits with BI_RLE4/8, so for now return
        an uncompressed bitmap if the bits buffer is large enough.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/x11drv/dib.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/dib.c,v
retrieving revision 1.11
diff -u -r1.11 dib.c
--- dlls/x11drv/dib.c	27 Mar 2004 01:37:09 -0000	1.11
+++ dlls/x11drv/dib.c	30 Mar 2004 11:46:37 -0000
@@ -72,6 +72,7 @@
     DWORD           bMask;
     BOOL            useShm;
     int             dibpitch;
+    DWORD           sizeImage;  
 } X11DRV_DIB_IMAGEBITS_DESCR;
 
 
@@ -3516,24 +3517,27 @@
        break;
 
     case 4:
-       if (descr->compression)
+        if (descr->compression) {
 	   FIXME("Compression not yet supported!\n");
-       else
-	   X11DRV_DIB_GetImageBits_4( descr->lines,(LPVOID)descr->bits,
-				      descr->infoWidth, descr->width,
-				      descr->colorMap, descr->palentry,
-				      bmpImage, descr->dibpitch );
-       break;
-
+           if(descr->sizeImage < X11DRV_DIB_GetDIBWidthBytes( descr->infoWidth, 4 ) * abs(descr->lines))
+               break;
+        }
+        X11DRV_DIB_GetImageBits_4( descr->lines,(LPVOID)descr->bits,
+                                   descr->infoWidth, descr->width,
+                                   descr->colorMap, descr->palentry,
+                                   bmpImage, descr->dibpitch );
+        break;
     case 8:
-       if (descr->compression)
+        if (descr->compression) {
 	   FIXME("Compression not yet supported!\n");
-       else
-	   X11DRV_DIB_GetImageBits_8( descr->lines, (LPVOID)descr->bits,
-				      descr->infoWidth, descr->width,
-				      descr->colorMap, descr->palentry,
-				      bmpImage, descr->dibpitch );
-       break;
+           if(descr->sizeImage < X11DRV_DIB_GetDIBWidthBytes( descr->infoWidth, 8 ) * abs(descr->lines))
+               break;
+        }
+        X11DRV_DIB_GetImageBits_8( descr->lines, (LPVOID)descr->bits,
+                                   descr->infoWidth, descr->width,
+                                   descr->colorMap, descr->palentry,
+                                   bmpImage, descr->dibpitch );
+        break;
     case 15:
     case 16:
        X11DRV_DIB_GetImageBits_16( descr->lines, (LPVOID)descr->bits,
@@ -3875,6 +3879,7 @@
   descr.xDest     = 0;
   descr.yDest     = 0;
   descr.xSrc      = 0;
+  descr.sizeImage = info->bmiHeader.biSizeImage;
 
   if (descr.lines > 0)
   {
@@ -4001,6 +4006,8 @@
   descr.yDest     = yDest;
   descr.width     = width;
   descr.height    = height;
+  descr.sizeImage = 0;
+
 #ifdef HAVE_LIBXXSHM
   descr.useShm = (dib->shminfo.shmid != -1);
 #else



More information about the wine-patches mailing list