Re: [AD] DirectDraw - create_sub_bitmap() or save_bitmap() faulty ?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> It works well with it.

Ok. I've attached the complete patch.

> (although I cannot understand how pushing/poping EDX twice solves the
> problem, but I suppose the function does something with the values in
> stack)

Yes, and that's why the bug doesn't occur in debugmode: in this mode, the 
compiler allocates as many stack slots as the C source prescribes, whereas 
in optimized mode it reuses the stack slot of the argument.

-- 
Eric Botcazou
--- /cvs/allegro/src/win/asmlock.s	Mon Sep 16 01:10:44 2002
+++ allegro/src/win/asmlock.s	Tue Apr  8 20:47:44 2003
@@ -38,8 +38,10 @@
       pushl %ecx
       pushl %eax
       pushl %edx
+      pushl %edx  /* argument */
       call *GLOBL(ptr_gfx_directx_autolock)
       popl %edx
+      popl %edx
       popl %eax
       popl %ecx
 
@@ -65,8 +67,10 @@
       pushl %ecx
       pushl %eax
       pushl %edx
+      pushl %edx  /* argument */
       call *GLOBL(ptr_gfx_directx_unlock)
       popl %edx
+      popl %edx
       popl %eax
       popl %ecx
 
@@ -98,8 +102,10 @@
       /* lock the surface */
       pushl %eax
       pushl %edx
+      pushl %edx  /* argument */
       call *GLOBL(ptr_gfx_directx_autolock)
       popl %edx
+      popl %edx
       popl %eax
 
    Locked_win:
@@ -126,8 +132,10 @@
 
       /* unlock surface */
       pushl %edx
+      pushl %edx  /* argument */
       call *GLOBL(ptr_gfx_directx_unlock)
       popl %edx
+      popl %edx
 
       /* clear the autolock flag */
       andl $~BMP_ID_AUTOLOCK, BMP_ID(%edx)
@@ -153,8 +161,10 @@
       /* unlock surface */
       movl 4(%esp), %edx
       pushl %edx 
+      pushl %edx  /* argument */
       call *GLOBL(ptr_gfx_directx_unlock)
       popl %edx
+      popl %edx
 
       /* forefront_bitmap may still be locked in case of nested locking */
       movl GLOBL(forefront_bitmap), %edx
@@ -246,8 +256,10 @@
       /* lock the surface */
       pushl %eax
       pushl %edx
+      pushl %edx  /* argument */
       call *GLOBL(ptr_gfx_gdi_autolock) 
       popl %edx
+      popl %edx
       popl %eax
 
    Locked_gdi:
@@ -273,8 +285,10 @@
       pushl %ecx
       pushl %eax
       pushl %edx
+      pushl %edx  /* argument */
       call *GLOBL(ptr_gfx_gdi_unlock) 
       popl %edx
+      popl %edx
       popl %eax
       popl %ecx
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/