mirror of
https://github.com/reactos/reactos.git
synced 2025-03-10 02:10:34 +00:00
remove most of the hack in createsurface
svn path=/trunk/; revision=25105
This commit is contained in:
parent
465b3d78e8
commit
b06bb7eb7e
1 changed files with 30 additions and 75 deletions
|
@ -205,89 +205,54 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
|
||||||
}
|
}
|
||||||
|
|
||||||
That->lpLcl = (LPDDRAWI_DDRAWSURFACE_LCL)DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_LCL));
|
That->lpLcl = (LPDDRAWI_DDRAWSURFACE_LCL)DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_LCL));
|
||||||
This->lpLcl->lpPrimary = That;
|
|
||||||
|
|
||||||
if (That == NULL)
|
if (That == NULL)
|
||||||
{
|
{
|
||||||
return E_OUTOFMEMORY;
|
return E_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 */
|
|
||||||
|
|
||||||
|
|
||||||
mDdCanCreateSurface.lpDD = This->lpLcl->lpGbl;
|
|
||||||
mDdCanCreateSurface.bIsDifferentPixelFormat = FALSE;
|
|
||||||
mDdCanCreateSurface.lpDDSurfaceDesc = (LPDDSURFACEDESC) pDDSD;
|
|
||||||
mDdCanCreateSurface.CanCreateSurface = This->lpLcl->lpDDCB->cbDDCallbacks.CanCreateSurface;
|
|
||||||
mDdCanCreateSurface.ddRVal = DDERR_GENERIC;
|
|
||||||
|
|
||||||
mDdCreateSurface.CreateSurface = This->lpLcl->lpDDCB->cbDDCallbacks.CreateSurface;
|
|
||||||
mDdCreateSurface.ddRVal = DDERR_GENERIC;
|
|
||||||
mDdCreateSurface.dwSCnt = That->dwIntRefCnt + 1; // is this correct
|
|
||||||
mDdCreateSurface.lpDDSurfaceDesc = (LPDDSURFACEDESC) pDDSD;
|
|
||||||
//mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist;
|
|
||||||
//mDdCreateSurface.lplpSList = &That->lpLcl;
|
|
||||||
|
|
||||||
SurfaceMore = DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_MORE));
|
SurfaceMore = DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_MORE));
|
||||||
if (SurfaceMore == NULL)
|
if (SurfaceMore == NULL)
|
||||||
{
|
{
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
That->lpVtbl = &DirectDrawSurface7_Vtable;
|
||||||
|
*ppSurf = (LPDIRECTDRAWSURFACE7)That;
|
||||||
|
|
||||||
|
|
||||||
|
That->lpLcl->lpGbl = &ddSurfGbl;
|
||||||
|
That->lpLcl->lpGbl->lpDD = &ddgbl;
|
||||||
|
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; //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
|
||||||
|
mDdCreateSurface.lpDDSurfaceDesc = (LPDDSURFACEDESC) pDDSD;
|
||||||
|
//mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist;
|
||||||
|
//mDdCreateSurface.lplpSList = &That->lpLcl;
|
||||||
|
|
||||||
if (pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
|
if (pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
|
||||||
{
|
{
|
||||||
DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
|
DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
|
||||||
DDSURFACEDESC mddsdPrimary;
|
|
||||||
|
|
||||||
This->lpLcl->lpGbl->lp16DD = This->lpLcl->lpGbl;
|
This->lpLcl->lpPrimary = That;
|
||||||
That->lpLcl->lpSurfMore = SurfaceMore;
|
That->lpLcl->lpSurfMore->slist = mpPrimaryLocals;
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
if (mDdCanCreateSurface.CanCreateSurface(&mDdCanCreateSurface)== DDHAL_DRIVER_NOTHANDLED)
|
if (mDdCanCreateSurface.CanCreateSurface(&mDdCanCreateSurface)== DDHAL_DRIVER_NOTHANDLED)
|
||||||
{
|
{
|
||||||
|
@ -299,29 +264,19 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
|
||||||
return DDERR_NOTINITIALIZED;
|
return DDERR_NOTINITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
That->lpLcl->lpGbl->dwGlobalFlags = DDRAWISURFGBL_ISGDISURFACE;
|
/* FIXME :
|
||||||
That->lpLcl->lpGbl->lpDD = This->lpLcl->lpGbl;
|
* This tree line is hack
|
||||||
That->lpLcl->lpGbl->lpDDHandle = This->lpLcl->lpGbl;
|
*/
|
||||||
That->lpLcl->lpGbl->wWidth = 1024; //(WORD)mpModeInfos[0].dwWidth;
|
That->lpLcl->lpGbl->wWidth = 1024; //(WORD)mpModeInfos[0].dwWidth;
|
||||||
That->lpLcl->lpGbl->wHeight = 768; //(WORD)mpModeInfos[0].dwHeight;
|
That->lpLcl->lpGbl->wHeight = 768; //(WORD)mpModeInfos[0].dwHeight;
|
||||||
That->lpLcl->lpGbl->lPitch = 32; //mpModeInfos[0].lPitch;
|
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->dwFlags = DDRAWISURF_PARTOFPRIMARYCHAIN|DDRAWISURF_HASOVERLAYDATA;
|
||||||
That->lpLcl->ddsCaps.dwCaps = mddsdPrimary.ddsCaps.dwCaps;
|
That->lpLcl->ddsCaps.dwCaps = pDDSD->ddsCaps.dwCaps;
|
||||||
|
|
||||||
mpPrimaryLocals[0] = That->lpLcl;
|
mpPrimaryLocals[0] = That->lpLcl;
|
||||||
|
|
||||||
mDdCreateSurface.lpDD = This->lpLcl->lpGbl;
|
mDdCreateSurface.lplpSList = That->lpLcl->lpSurfMore->slist;
|
||||||
mDdCreateSurface.CreateSurface = This->lpLcl->lpDDCB->HALDD.CreateSurface;
|
|
||||||
mDdCreateSurface.lpDDSurfaceDesc = &mddsdPrimary;//pDDSD;
|
|
||||||
mDdCreateSurface.lplpSList = mpPrimaryLocals; //cSurfaces;
|
|
||||||
mDdCreateSurface.dwSCnt = 1 ; //ppSurfaces;
|
|
||||||
|
|
||||||
if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED)
|
if (mDdCreateSurface.CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue