Re: Getting DXBall to run

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I traced it down to dlls/ddraw/dsurface/dib.c:create_dib where
> it says:
> 
>     if (!This->surface_desc.lpSurface) {
>         This->surface_desc.lpSurface = priv->dib.bitmap_data;
>         This->surface_desc.dwFlags |= DDSD_LPSURFACE;
>     }
> 
> I don't see why This->surface_desc.lpSurface is being tested
> here before doing the assignment since up in the function 
> there's this assert statement:
> 
>     assert(This->surface_desc.lpSurface != NULL);

Well, Wine will crash if 'This->surface_desc.lpSurface' is NULL.
This means that the '!This->surface_desc.lpSurface' test will always be
FALSE (otherwise we would have crashed before).

The real problem is that the application is setting the PITCH flag and gives
us a Pitch set to '0'... Which is *not* a good thing :-)

I tested the attached patch and it seems to work too (and I feel that it's a
bit better :-) ).

        Lionel

-- 
		 Lionel Ulmer - http://www.bbrox.org/
Index: dlls/ddraw/dsurface/dib.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/dsurface/dib.c,v
retrieving revision 1.27
diff -u -r1.27 dib.c
--- dlls/ddraw/dsurface/dib.c	11 Feb 2003 21:58:07 -0000	1.27
+++ dlls/ddraw/dsurface/dib.c	16 May 2003 20:53:44 -0000
@@ -114,6 +114,13 @@
     b_info->bmiHeader.biClrUsed = 0;
     b_info->bmiHeader.biClrImportant = 0;
 
+    if (!This->surface_desc.u1.lPitch) {
+	/* This can't happen, right? */
+	/* or use GDI_GetObj to get it from the created DIB? */
+	This->surface_desc.u1.lPitch = get_dib_width_bytes(b_info->bmiHeader.biWidth, b_info->bmiHeader.biBitCount);
+	This->surface_desc.dwFlags |= DDSD_PITCH;
+    }
+    
     switch (This->surface_desc.u4.ddpfPixelFormat.u1.dwRGBBitCount)
     {
     case 16:
@@ -158,12 +165,6 @@
     }
 
     TRACE("DIBSection at : %p\n", priv->dib.bitmap_data);
-    if (!This->surface_desc.u1.lPitch) {
-	/* This can't happen, right? */
-	/* or use GDI_GetObj to get it from the created DIB? */
-	This->surface_desc.u1.lPitch = get_dib_width_bytes(b_info->bmiHeader.biWidth, b_info->bmiHeader.biBitCount);
-	This->surface_desc.dwFlags |= DDSD_PITCH;
-    }
 
     if (!This->surface_desc.lpSurface) {
 	This->surface_desc.lpSurface = priv->dib.bitmap_data;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux