Alexandre Julliard : gdi: Added support for doing GetBitmapBits on a DIB section.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 13 12:24:53 CST 2005


Module: wine
Branch: refs/heads/master
Commit: 7e2be17d0f1442559dae38c2982bf4d424ace65a
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=7e2be17d0f1442559dae38c2982bf4d424ace65a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 13 17:07:06 2005 +0100

gdi: Added support for doing GetBitmapBits on a DIB section.
Simply copy the DIB bits in that case.

---

 dlls/gdi/bitmap.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi/bitmap.c b/dlls/gdi/bitmap.c
index a0c6b25..5c2b6c3 100644
--- a/dlls/gdi/bitmap.c
+++ b/dlls/gdi/bitmap.c
@@ -307,6 +307,30 @@ LONG WINAPI GetBitmapBits(
 
     if (!bmp) return 0;
 
+    if (bmp->dib)  /* simply copy the bits from the DIB */
+    {
+        DIBSECTION *dib = bmp->dib;
+        const char *src = dib->dsBm.bmBits;
+        DWORD max = dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight;
+        if (count > max) count = max;
+        ret = count;
+        if (!bits) goto done;
+
+        if (bmp->dib->dsBmih.biHeight >= 0)  /* not top-down, need to flip contents vertically */
+        {
+            src += dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight;
+            while (count > 0)
+            {
+                src -= dib->dsBm.bmWidthBytes;
+                memcpy( bits, src, min( count, dib->dsBm.bmWidthBytes ) );
+                bits = (char *)bits + dib->dsBm.bmWidthBytes;
+                count -= dib->dsBm.bmWidthBytes;
+            }
+        }
+        else memcpy( bits, src, count );
+        goto done;
+    }
+
     /* If the bits vector is null, the function should return the read size */
     if(bits == NULL)
     {




More information about the wine-cvs mailing list