Commit a5c484cb authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw: GetSurfaceDesc returns the surface memory while the surface is locked.

parent e7b68eec
......@@ -585,7 +585,6 @@ IDirectDrawSurfaceImpl_Lock(IDirectDrawSurface7 *iface,
DDSD->dwSize = sizeof(DDSURFACEDESC2);
}
DD_STRUCT_COPY_BYSIZE(DDSD,&(This->surface_desc));
hr = IWineD3DSurface_LockRect(This->WineD3DSurface,
&LockedRect,
Rect,
......@@ -596,7 +595,8 @@ IDirectDrawSurfaceImpl_Lock(IDirectDrawSurface7 *iface,
* does not set the LPSURFACE flag on locked surfaces !?!.
* DDSD->dwFlags |= DDSD_LPSURFACE;
*/
DDSD->lpSurface = LockedRect.pBits;
This->surface_desc.lpSurface = LockedRect.pBits;
DD_STRUCT_COPY_BYSIZE(DDSD,&(This->surface_desc));
TRACE("locked surface returning description :\n");
if (TRACE_ON(ddraw)) DDRAW_dump_surface_desc(DDSD);
......@@ -622,9 +622,15 @@ IDirectDrawSurfaceImpl_Unlock(IDirectDrawSurface7 *iface,
RECT *pRect)
{
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawSurface7, iface);
HRESULT hr;
TRACE("(%p)->(%p)\n", This, pRect);
return IWineD3DSurface_UnlockRect(This->WineD3DSurface);
hr = IWineD3DSurface_UnlockRect(This->WineD3DSurface);
if(SUCCEEDED(hr))
{
This->surface_desc.lpSurface = NULL;
}
return hr;
}
/*****************************************************************************
......
......@@ -174,8 +174,7 @@ static void SrcColorKey32BlitTest(void)
{
LPDIRECTDRAWSURFACE lpSrc;
LPDIRECTDRAWSURFACE lpDst;
DDSURFACEDESC ddsd;
DDSURFACEDESC ddsd2;
DDSURFACEDESC ddsd, ddsd2, ddsd3;
DDCOLORKEY DDColorKey;
LPDWORD lpData;
HRESULT rc;
......@@ -211,9 +210,24 @@ static void SrcColorKey32BlitTest(void)
lpData[1] = 0xCCCCCCCC;
lpData[2] = 0xCCCCCCCC;
lpData[3] = 0xCCCCCCCC;
memset(&ddsd3, 0, sizeof(ddsd3));
ddsd3.dwSize = sizeof(ddsd3);
U4(ddsd3).ddpfPixelFormat.dwSize = sizeof(U4(ddsd3).ddpfPixelFormat);
rc = IDirectDrawSurface_GetSurfaceDesc(lpDst, &ddsd3);
ok(rc == DD_OK, "IDirectDrawSurface_GetSurfaceDesc between a lock/unlock pair returned %08x\n", rc);
ok(ddsd3.lpSurface == ddsd3.lpSurface, "lpSurface from GetSurfaceDesc(%p) differs from the one returned by Lock(%p)\n", ddsd3.lpSurface, ddsd2.lpSurface);
rc = IDirectDrawSurface_Unlock(lpDst, NULL);
ok(rc==DD_OK,"Unlock returned: %x\n",rc);
memset(&ddsd3, 0, sizeof(ddsd3));
ddsd3.dwSize = sizeof(ddsd3);
U4(ddsd3).ddpfPixelFormat.dwSize = sizeof(U4(ddsd3).ddpfPixelFormat);
rc = IDirectDrawSurface_GetSurfaceDesc(lpDst, &ddsd3);
ok(rc == DD_OK, "IDirectDrawSurface_GetSurfaceDesc between a lock/unlock pair returned %08x\n", rc);
ok(ddsd3.lpSurface == NULL, "lpSurface from GetSurfaceDesc(%p) is not NULL after unlock\n", ddsd3.lpSurface);
rc = IDirectDrawSurface_Lock(lpSrc, NULL, &ddsd2, DDLOCK_WAIT, NULL);
ok(rc==DD_OK,"Lock returned: %x\n",rc);
ok((ddsd2.dwFlags & DDSD_LPSURFACE) == 0, "Surface desc has LPSURFACE Flags set\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment