Author: greatlrd Date: Sun Nov 23 05:00:11 2008 New Revision: 37581
URL: http://svn.reactos.org/svn/reactos?rev=37581&view=rev Log: Finish Implement DCIDestroy() it free all alloc res now.
Modified: branches/reactx/reactos/dll/win32/dciman32/dciman_main.c
Modified: branches/reactx/reactos/dll/win32/dciman32/dciman_main.c URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/dciman3... ============================================================================== --- branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] (original) +++ branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] Sun Nov 23 05:00:11 2008 @@ -176,7 +176,7 @@ DDSurfaceDesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_VISIBLE ;
/* Setup DDHAL_CREATESURFACEDATA for createsurface */ - lpcsd.lpDD = pDciSurface_int->DciSurface_lcl.SurfaceGlobal.lpDD; + lpcsd.lpDD = &pDciSurface_int->DciSurface_lcl.DirectDrawGlobal; lpcsd.lpDDSurfaceDesc = &DDSurfaceDesc; SurfaceLocal_List[0] = &pDciSurface_int->DciSurface_lcl.SurfaceLocal; lpcsd.lplpSList = SurfaceLocal_List; @@ -269,6 +269,7 @@
void WINAPI DCIDestroy(LPDCISURFACEINFO pDciSurfaceInfo) { + DDHAL_DESTROYSURFACEDATA lpcsd; LPDCISURFACE_INT pDciSurface_int = NULL; if (pDciSurfaceInfo != NULL) { @@ -278,18 +279,28 @@ /* If we lost the primary surface we do not destory it, */ if (pDciSurface_int->DciSurface_lcl.LostSurface == FALSE) { - /* Fixme destore the primary surface */ - - /* Check see if dx hal support DestroySurface */ - if ( (pDciSurface_int->DciSurface_lcl.DDSurfaceCallbacks.dwFlags & DDHAL_SURFCB32_DESTROYSURFACE) == DDHAL_SURFCB32_DESTROYSURFACE) - { - // lpcsd.DestroySurface = pDciSurface_int->DciSurface_lcl.DDSurfaceCallbacks.DestroySurface; - } - - - /* Destroy the Ddraw object */ + + /* Check see if we have a Ddraw object or not */ if (pDciSurface_int->DciSurface_lcl.DirectDrawGlobal.hDD != 0) { + + /* Destory the surface */ + if ( pDciSurface_int->DciSurface_lcl.DDSurfaceCallbacks.dwFlags & DDHAL_SURFCB32_DESTROYSURFACE) == DDHAL_SURFCB32_DESTROYSURFACE) && + (pDciSurface_int->DciSurface_lcl.SurfaceLocal.hDDSurface != 0) ) + { + /* setup data to destory primary surface if we got one */ + lpcsd.lpDD = &pDciSurface_int->DciSurface_lcl.DirectDrawGlobal; + lpcsd.lpDDSurface = &pDciSurface_int->DciSurface_lcl.SurfaceLocal; + lpcsd.ddRVal = DDERR_GENERIC; + lpcsd.DestroySurface = pDciSurface_int->DciSurface_lcl.DDSurfaceCallbacks.DestroySurface; + + /* Destory the surface */ + lpcsd.DestroySurface(&lpcsd); + + /* Do noting if we fail to destory the surface */ + } + + /* Destroy the Ddraw object */ DdDeleteDirectDrawObject(&pDciSurface_int->DciSurface_lcl.DirectDrawGlobal); }