Add new struct call EDD_SURFACE_LOCAL it is base on DD_SURFACE_LOCAL

Change DxLocksurface using this new struct 

svn path=/trunk/; revision=31510
This commit is contained in:
Magnus Olsen 2007-12-31 02:54:23 +00:00
parent a4aca0de8c
commit 39075187dd
2 changed files with 13 additions and 4 deletions

View file

@ -62,6 +62,12 @@ typedef struct _DD_BASEOBJECT
PVOID pUser;
} DD_ENTRY, *PDD_ENTRY;
typedef struct _EDD_SURFACE_LOCAL
{
DD_BASEOBJECT Object;
DD_SURFACE_LOCAL Surfacelcl;
} EDD_SURFACE_LOCAL, *PEDD_SURFACE_LOCAL;

View file

@ -16,12 +16,13 @@ PDD_SURFACE_LOCAL
STDCALL
DxDdLockDirectDrawSurface(HANDLE hDdSurface)
{
PEDD_SURFACE_LOCAL pEDDSurfacelcl = NULL;
PDD_SURFACE_LOCAL pSurfacelcl = NULL;
pSurfacelcl = DdHmgLock(hDdSurface, 2, FALSE);
if (pSurfacelcl != NULL)
{
pSurfacelcl = (PDD_SURFACE_LOCAL)(((PBYTE)&pSurfacelcl) + sizeof(DD_BASEOBJECT));
pSurfacelcl = &pEDDSurfacelcl->Surfacelcl;
}
return pSurfacelcl;
@ -32,12 +33,12 @@ STDCALL
DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface)
{
BOOL retVal = FALSE;
PDD_BASEOBJECT pObject = NULL;
PEDD_SURFACE_LOCAL pEDDSurfacelcl = NULL;
if (pSurface)
{
pObject = (PDD_BASEOBJECT)( ((PBYTE)&pSurface) - sizeof(DD_BASEOBJECT));
InterlockedDecrement(&pObject->cExclusiveLock);
pEDDSurfacelcl = (PEDD_SURFACE_LOCAL)( ((PBYTE)pSurface) - sizeof(DD_BASEOBJECT));
InterlockedDecrement(&pEDDSurfacelcl->Object.cExclusiveLock);
retVal = TRUE;
}
@ -45,3 +46,5 @@ DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface)
}