wine/dlls/gdi bitmap.c

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 29 05:06:17 CST 2005


ChangeSet ID:	21530
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/29 05:06:17

Modified files:
	dlls/gdi       : bitmap.c 

Log message:
	Added support for doing SetBitmapBits on a DIB section.

Patch: http://cvs.winehq.org/patch.py?id=21530

Old revision  New revision  Changes     Path
 1.8           1.9           +25 -0      wine/dlls/gdi/bitmap.c

Index: wine/dlls/gdi/bitmap.c
diff -u -p wine/dlls/gdi/bitmap.c:1.8 wine/dlls/gdi/bitmap.c:1.9
--- wine/dlls/gdi/bitmap.c:1.8	29 Nov 2005 11: 6:17 -0000
+++ wine/dlls/gdi/bitmap.c	29 Nov 2005 11: 6:17 -0000
@@ -381,6 +381,31 @@ LONG WINAPI SetBitmapBits(
 	count = -count;
     }
 
+    if (bmp->dib)  /* simply copy the bits into the DIB */
+    {
+        DIBSECTION *dib = bmp->dib;
+        char *dest = dib->dsBm.bmBits;
+        DWORD max = dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight;
+        if (count > max) count = max;
+        ret = count;
+
+        if (bmp->dib->dsBmih.biHeight >= 0)  /* not top-down, need to flip contents vertically */
+        {
+            dest += dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight;
+            while (count > 0)
+            {
+                dest -= dib->dsBm.bmWidthBytes;
+                memcpy( dest, bits, min( count, dib->dsBm.bmWidthBytes ) );
+                bits = (char *)bits + dib->dsBm.bmWidthBytes;
+                count -= dib->dsBm.bmWidthBytes;
+            }
+        }
+        else memcpy( dest, bits, count );
+
+        GDI_ReleaseObj( hbitmap );
+        return ret;
+    }
+
     /* Only get entire lines */
     height = count / bmp->bitmap.bmWidthBytes;
     if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight;



More information about the wine-cvs mailing list