Roderick Colenbrander : wined3d: Make sure SFLAG_LOCKED is set at the start of LockRect as various functions called from LockRect depend on it (e.g. LoadTexture if called from LoadLocation).

Alexandre Julliard julliard at winehq.org
Fri Nov 9 07:44:21 CST 2007


Module: wine
Branch: master
Commit: b238e39ec86bfa14a2d996d30c5084e96464c14b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b238e39ec86bfa14a2d996d30c5084e96464c14b

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Thu Nov  8 22:44:34 2007 +0100

wined3d: Make sure SFLAG_LOCKED is set at the start of LockRect as various functions called from LockRect depend on it (e.g. LoadTexture if called from LoadLocation).

---

 dlls/wined3d/surface.c      |    6 ++++++
 dlls/wined3d/surface_base.c |   17 -----------------
 dlls/wined3d/surface_gdi.c  |    9 +++++++++
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 1ee7b6f..d3cbc52 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -799,6 +799,12 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED
         WARN("Surface is already locked, returning D3DERR_INVALIDCALL\n");
         return WINED3DERR_INVALIDCALL;
     }
+    This->Flags |= SFLAG_LOCKED;
+
+    if (!(This->Flags & SFLAG_LOCKABLE))
+    {
+        TRACE("Warning: trying to lock unlockable surf@%p\n", This);
+    }
 
     if (Flags & WINED3DLOCK_DISCARD) {
         /* Set SFLAG_INSYSMEM, so we'll never try to download the data from the texture. */
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 6b9c631..11a3d0b 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -1573,22 +1573,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DL
 {
     IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
 
-    /* Already locked? */
-    if(This->Flags & SFLAG_LOCKED)
-    {
-        ERR("(%p) Surface already locked\n", This);
-        /* What should I return here? */
-        return WINED3DERR_INVALIDCALL;
-    }
-
-    if (!(This->Flags & SFLAG_LOCKABLE))
-    {
-        /* This is some GL specific thing, see the OpenGL version of
-         * this method, but check for the flag and write a trace
-         */
-        TRACE("Warning: trying to lock unlockable surf@%p\n", This);
-    }
-
     TRACE("(%p) : rect@%p flags(%08x), output lockedRect@%p, memory@%p\n",
           This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
 
@@ -1642,6 +1626,5 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DL
     /* No dirtifying is needed for this surface implementation */
     TRACE("returning memory@%p, pitch(%d)\n", pLockedRect->pBits, pLockedRect->Pitch);
 
-    This->Flags |= SFLAG_LOCKED;
     return WINED3D_OK;
 }
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index a5ca3db..03852f8 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -205,6 +205,15 @@ IWineGDISurfaceImpl_LockRect(IWineD3DSurface *iface,
 {
     IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
 
+    /* Already locked? */
+    if(This->Flags & SFLAG_LOCKED)
+    {
+        ERR("(%p) Surface already locked\n", This);
+        /* What should I return here? */
+        return WINED3DERR_INVALIDCALL;
+    }
+    This->Flags |= SFLAG_LOCKED;
+
     if(!This->resource.allocatedMemory) {
         /* This happens on gdi surfaces if the application set a user pointer and resets it.
          * Recreate the DIB section




More information about the wine-cvs mailing list