Commit 9cf27b5f authored by Matthew Mastracci's avatar Matthew Mastracci Committed by Alexandre Julliard

Added surface locking.

parent d9e36342
......@@ -277,6 +277,7 @@ struct IDirectDrawSurfaceImpl
RECT lastlockrect;
DWORD lastlocktype;
BOOL dc_in_use;
BOOL locked;
HRESULT (*duplicate_surface)(IDirectDrawSurfaceImpl* src,
LPDIRECTDRAWSURFACE7* dst);
......
......@@ -514,6 +514,11 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
}
}
if (This->locked || ((IDirectDrawSurfaceImpl *)src)->locked) {
WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
return DDERR_SURFACEBUSY;
}
/* First, check if the possible override function handles this case */
if (This->aux_blt != NULL) {
if (This->aux_blt(This, rdst, src, rsrc, dwFlags, lpbltfx) == DD_OK) return DD_OK;
......@@ -985,6 +990,11 @@ DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
TRACE(" srcrect: NULL\n");
}
if (This->locked || ((IDirectDrawSurfaceImpl *)src)->locked) {
WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
return DDERR_SURFACEBUSY;
}
/* First, check if the possible override function handles this case */
if (This->aux_bltfast != NULL) {
if (This->aux_bltfast(This, dstx, dsty, src, rsrc, trans) == DD_OK) return DD_OK;
......
......@@ -1094,6 +1094,12 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
}
}
/* If the surface is already locked, return busy */
if (This->locked) {
WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
return DDERR_SURFACEBUSY;
}
/* First, copy the Surface description */
DD_STRUCT_COPY_BYSIZE(pDDSD,&(This->surface_desc));
......@@ -1142,6 +1148,8 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
This->lock_update(This, NULL, flags);
}
This->locked = TRUE;
TRACE("locked surface returning description : \n");
if (TRACE_ON(ddraw)) DDRAW_dump_surface_desc(pDDSD);
......@@ -1417,6 +1425,12 @@ Main_DirectDrawSurface_Unlock(LPDIRECTDRAWSURFACE7 iface, LPRECT pRect)
TRACE("(%p)->Unlock(%p)\n",This,pRect);
if (!This->locked) {
WARN("Surface not locked - returing DDERR_NOTLOCKED\n");
return DDERR_NOTLOCKED;
}
This->locked = FALSE;
This->unlock_update(This, pRect);
if (This->aux_unlock)
This->aux_unlock(This->aux_ctx, This->aux_data, pRect);
......
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