powerpoint: images upside down

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Nov 28 04:00:16 CST 2005


On Mon, Nov 28, 2005 at 05:58:50PM +1000, Cihan Altinay wrote:
> Hi,
> 
> When using MS Powerpoint 2003 images are drawn upside down in fullscreen
> (presentation) mode but not in design mode.
> Also, text is drawn correctly as seen on the attachments.
> 
> I would appreciate a hint on what traces/logs to provide for more info
> as the dc & win output is quite long.

It's because there's no implementation of SetBitmapBits for dib
sections.  Alexandre committed this patch to the CrossOver tree, I'm
not sure why it didn't make it into WineHQ.

Huw.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/gdi/bitmap.c
===================================================================
RCS file: /cvstrees/crossover/office/wine/dlls/gdi/bitmap.c,v
retrieving revision 1.1.1.7.6.2
retrieving revision 1.1.1.7.6.3
diff -u -p -r1.1.1.7.6.2 -r1.1.1.7.6.3
--- dlls/gdi/bitmap.c	7 Oct 2005 16:42:05 -0000	1.1.1.7.6.2
+++ dlls/gdi/bitmap.c	24 Oct 2005 11:31:35 -0000	1.1.1.7.6.3
@@ -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-devel mailing list