Number of surface Lock/Unlocks must NOT match, so do NOT use it for

reference counting.
This commit is contained in:
Marcus Meissner 2000-05-09 22:33:12 +00:00 committed by Alexandre Julliard
parent f561aadffc
commit b7ed6df279
2 changed files with 13 additions and 8 deletions

View File

@ -31,8 +31,13 @@ HRESULT WINAPI IDirectDrawSurface4Impl_Lock(
LPDIRECTDRAWSURFACE4 iface,LPRECT lprect,LPDDSURFACEDESC lpddsd,DWORD flags, HANDLE hnd
) {
ICOM_THIS(IDirectDrawSurface4Impl,iface);
TRACE("(%p)->Lock(%p,%p,%08lx,%08lx)\n",
This,lprect,lpddsd,flags,(DWORD)hnd);
/* DO NOT AddRef the surface! Lock/Unlock must not come in matched pairs
* -Marcus Meissner 20000509
*/
if (flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY))
WARN("(%p)->Lock(%p,%p,%08lx,%08lx)\n",
This,lprect,lpddsd,flags,(DWORD)hnd);
@ -68,6 +73,10 @@ HRESULT WINAPI IDirectDrawSurface4Impl_Unlock(
LPDIRECTDRAWSURFACE4 iface,LPVOID surface
) {
ICOM_THIS(IDirectDrawSurface4Impl,iface);
/* DO NOT Release the surface! Lock/Unlock MUST NOT come in matched pairs
* Marcus Meissner 20000509
*/
TRACE("(%p)->Unlock(%p)\n",This,surface);
return DD_OK;
}
@ -170,11 +179,6 @@ HRESULT WINAPI IDirectDrawSurface4Impl_Blt(
if (src) IDirectDrawSurface4_Lock(src, NULL, &sdesc, 0, 0);
IDirectDrawSurface4_Lock(iface,NULL,&ddesc,0,0);
if (src && sdesc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
ERR("blitting FROM a primary surface? Hello?\n");
if (!(ddesc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
ERR("NOT blitting into a primary surface? Hello?\n");
if (TRACE_ON(ddraw)) {
if (rdst) TRACE("\tdestrect :%dx%d-%dx%d\n",rdst->left,rdst->top,rdst->right,rdst->bottom);
if (rsrc) TRACE("\tsrcrect :%dx%d-%dx%d\n",rsrc->left,rsrc->top,rsrc->right,rsrc->bottom);

View File

@ -86,8 +86,8 @@ HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_Lock(
DSPRIVATE(This);
DDPRIVATE(This->s.ddraw);
IDirectDrawSurface4_AddRef(iface);
/* DO NOT AddRef the surface! Lock/Unlock are NOT guaranteed to come in
* matched pairs! - Marcus Meissner 20000509 */
TRACE("(%p)->Lock(%p,%p,%08lx,%08lx)\n",This,lprect,lpddsd,flags,(DWORD)hnd);
if (flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY))
WARN("(%p)->Lock(%p,%p,%08lx,%08lx)\n",
@ -193,7 +193,8 @@ HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_Unlock(
TSXSetWindowColormap(display,ddpriv->drawable,dppriv->cm);
}
}
IDirectDrawSurface4_Release(iface);
/* DO NOT Release the surface! Lock/Unlock are NOT guaranteed to come in
* matched pairs! - Marcus Meissner 20000509 */
return DD_OK;
}