Author: greatlrd Date: Sun Dec 10 00:41:42 2006 New Revision: 25105
URL: http://svn.reactos.org/svn/reactos?rev=25105&view=rev Log: remove most of the hack in createsurface
Modified: trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
Modified: trunk/reactos/dll/directx/ddraw/main/ddraw_main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main/ddra... ============================================================================== --- trunk/reactos/dll/directx/ddraw/main/ddraw_main.c (original) +++ trunk/reactos/dll/directx/ddraw/main/ddraw_main.c Sun Dec 10 00:41:42 2006 @@ -205,59 +205,41 @@ }
That->lpLcl = (LPDDRAWI_DDRAWSURFACE_LCL)DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_LCL)); - This->lpLcl->lpPrimary = That; - + if (That == NULL) { return E_OUTOFMEMORY; }
+ SurfaceMore = DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_MORE)); + if (SurfaceMore == NULL) + { + return DDERR_OUTOFMEMORY; + } + That->lpVtbl = &DirectDrawSurface7_Vtable; *ppSurf = (LPDIRECTDRAWSURFACE7)That;
+ That->lpLcl->lpGbl = &ddSurfGbl; That->lpLcl->lpGbl->lpDD = &ddgbl; - - - /* Code from wine cvs 24/7-2006 */ - - if (!(pDDSD->dwFlags & DDSD_CAPS)) - { - /* DVIDEO.DLL does forget the DDSD_CAPS flag ... *sigh* */ - pDDSD->dwFlags |= DDSD_CAPS; - } - if (pDDSD->ddsCaps.dwCaps == 0) - { - /* This has been checked on real Windows */ - pDDSD->ddsCaps.dwCaps = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY; - } - - - if (pDDSD->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) - { - /* If the surface is of the 'alloconload' type, ignore the LPSURFACE field */ - pDDSD->dwFlags &= ~DDSD_LPSURFACE; - } - - DX_STUB_str("pDDSD->ddsCaps.dwCaps ok"); - - if ((pDDSD->dwFlags & DDSD_LPSURFACE) && (pDDSD->lpSurface == NULL)) - { - /* Frank Herbert's Dune specifies a null pointer for the surface, ignore the LPSURFACE field */ - pDDSD->dwFlags &= ~DDSD_LPSURFACE; - } - - DX_STUB_str("pDDSD->dwFlags ok"); - - /* own code now */ - + That->lpLcl->lpSurfMore = SurfaceMore; + That->lpLcl->lpSurfMore->dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE); + That->lpLcl->lpSurfMore->lpDD_int = This; + That->lpLcl->lpSurfMore->lpDD_lcl = This->lpLcl; + That->lpLcl->dwProcessId = GetCurrentProcessId(); + + /* this two line should be move to startup code */ + That->lpLcl->lpGbl->lpDD = This->lpLcl->lpGbl; + That->lpLcl->lpGbl->lpDDHandle = This->lpLcl->lpGbl;
mDdCanCreateSurface.lpDD = This->lpLcl->lpGbl; - mDdCanCreateSurface.bIsDifferentPixelFormat = FALSE; + mDdCanCreateSurface.bIsDifferentPixelFormat = FALSE; //isDifferentPixelFormat; mDdCanCreateSurface.lpDDSurfaceDesc = (LPDDSURFACEDESC) pDDSD; mDdCanCreateSurface.CanCreateSurface = This->lpLcl->lpDDCB->cbDDCallbacks.CanCreateSurface; mDdCanCreateSurface.ddRVal = DDERR_GENERIC;
+ mDdCreateSurface.lpDD = This->lpLcl->lpGbl; mDdCreateSurface.CreateSurface = This->lpLcl->lpDDCB->cbDDCallbacks.CreateSurface; mDdCreateSurface.ddRVal = DDERR_GENERIC; mDdCreateSurface.dwSCnt = That->dwIntRefCnt + 1; // is this correct @@ -265,30 +247,13 @@ //mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist; //mDdCreateSurface.lplpSList = &That->lpLcl; - SurfaceMore = DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_MORE)); - if (SurfaceMore == NULL) - { - return DDERR_OUTOFMEMORY; - } - if (pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) { DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1]; - DDSURFACEDESC mddsdPrimary; - - This->lpLcl->lpGbl->lp16DD = This->lpLcl->lpGbl; - That->lpLcl->lpSurfMore = SurfaceMore; - - ZeroMemory(&mddsdPrimary, sizeof(DDSURFACEDESC)); - mddsdPrimary.dwSize = sizeof(DDSURFACEDESC); - mddsdPrimary.dwFlags = DDSD_CAPS; - mddsdPrimary.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_VIDEOMEMORY | DDSCAPS_VISIBLE;
- mDdCanCreateSurface.lpDD = This->lpLcl->lpGbl; - mDdCanCreateSurface.CanCreateSurface = This->lpLcl->lpDDCB->HALDD.CanCreateSurface; - mDdCanCreateSurface.bIsDifferentPixelFormat = FALSE; //isDifferentPixelFormat; - mDdCanCreateSurface.lpDDSurfaceDesc = &mddsdPrimary; // pDDSD; - + This->lpLcl->lpPrimary = That; + That->lpLcl->lpSurfMore->slist = mpPrimaryLocals; + if (mDdCanCreateSurface.CanCreateSurface(&mDdCanCreateSurface)== DDHAL_DRIVER_NOTHANDLED) { return DDERR_NOTINITIALIZED; @@ -298,31 +263,21 @@ { return DDERR_NOTINITIALIZED; } - - That->lpLcl->lpGbl->dwGlobalFlags = DDRAWISURFGBL_ISGDISURFACE; - That->lpLcl->lpGbl->lpDD = This->lpLcl->lpGbl; - That->lpLcl->lpGbl->lpDDHandle = This->lpLcl->lpGbl; + + /* FIXME : + * This tree line is hack + */ That->lpLcl->lpGbl->wWidth = 1024; //(WORD)mpModeInfos[0].dwWidth; That->lpLcl->lpGbl->wHeight = 768; //(WORD)mpModeInfos[0].dwHeight; That->lpLcl->lpGbl->lPitch = 32; //mpModeInfos[0].lPitch; - - memset(SurfaceMore, 0, sizeof(DDRAWI_DDRAWSURFACE_MORE)); - SurfaceMore->dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE); - - That->lpLcl->lpGbl = That->lpLcl->lpGbl; - That->lpLcl->lpSurfMore = SurfaceMore; - That->lpLcl->dwProcessId = GetCurrentProcessId(); + That->lpLcl->dwFlags = DDRAWISURF_PARTOFPRIMARYCHAIN|DDRAWISURF_HASOVERLAYDATA; - That->lpLcl->ddsCaps.dwCaps = mddsdPrimary.ddsCaps.dwCaps; + That->lpLcl->ddsCaps.dwCaps = pDDSD->ddsCaps.dwCaps;
mpPrimaryLocals[0] = That->lpLcl; - - mDdCreateSurface.lpDD = This->lpLcl->lpGbl; - mDdCreateSurface.CreateSurface = This->lpLcl->lpDDCB->HALDD.CreateSurface; - mDdCreateSurface.lpDDSurfaceDesc = &mddsdPrimary;//pDDSD; - mDdCreateSurface.lplpSList = mpPrimaryLocals; //cSurfaces; - mDdCreateSurface.dwSCnt = 1 ; //ppSurfaces; - + + mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist; + if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED) { return DDERR_NOTINITIALIZED;