mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:16:04 +00:00
first part to change the arch of Surface time move surface into it own struct. so we can easy create a new one. no surface should be store global in ddraw.dll
svn path=/trunk/; revision=21508
This commit is contained in:
parent
617afc2f76
commit
ef869b1127
3 changed files with 44 additions and 15 deletions
|
@ -11,10 +11,11 @@
|
|||
#include "rosdraw.h"
|
||||
|
||||
|
||||
HRESULT Hal_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD, LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter)
|
||||
HRESULT Hal_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD, IDirectDrawSurfaceImpl *ppSurf, IUnknown *pUnkOuter)
|
||||
{
|
||||
UINT i;
|
||||
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
|
||||
IDirectDrawSurfaceImpl* That = ppSurf;
|
||||
|
||||
DDHAL_CREATESURFACEDATA mDdCreateSurface;
|
||||
DDHAL_CANCREATESURFACEDATA mDdCanCreateSurface;
|
||||
|
@ -65,10 +66,10 @@ HRESULT Hal_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDS
|
|||
*/
|
||||
//This->mPrimaryLocal.dwFlags = DDRAWISURF_PARTOFPRIMARYCHAIN|DDRAWISURF_HASOVERLAYDATA;
|
||||
This->mPrimaryLocal.ddsCaps.dwCaps = This->mddsdPrimary.ddsCaps.dwCaps;
|
||||
This->mpPrimaryLocals[0] = &This->mPrimaryLocal;
|
||||
That->Surf->mpPrimaryLocals[0] = &This->mPrimaryLocal;
|
||||
|
||||
mDdCreateSurface.lpDDSurfaceDesc = &This->mddsdPrimary;
|
||||
mDdCreateSurface.lplpSList = This->mpPrimaryLocals;
|
||||
mDdCreateSurface.lplpSList = That->Surf->mpPrimaryLocals;
|
||||
mDdCreateSurface.dwSCnt = This->mDDrawGlobal.dsList->dwIntRefCnt ;
|
||||
|
||||
if (This->mHALInfo.lpDDCallbacks->CreateSurface(&mDdCreateSurface) == DDHAL_DRIVER_NOTHANDLED)
|
||||
|
@ -176,7 +177,7 @@ HRESULT Hal_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDS
|
|||
DDHAL_UPDATEOVERLAYDATA mDdUpdateOverlay;
|
||||
mDdUpdateOverlay.lpDD = &This->mDDrawGlobal;
|
||||
mDdUpdateOverlay.UpdateOverlay = This->mCallbacks.HALDDSurface.UpdateOverlay;
|
||||
mDdUpdateOverlay.lpDDDestSurface = This->mpPrimaryLocals[0];
|
||||
mDdUpdateOverlay.lpDDDestSurface = That->Surf->mpPrimaryLocals[0];
|
||||
mDdUpdateOverlay.lpDDSrcSurface = This->mpOverlayLocals[0];//pDDSurface;
|
||||
mDdUpdateOverlay.dwFlags = DDOVER_SHOW;
|
||||
|
||||
|
@ -227,17 +228,23 @@ HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rDest,
|
|||
LPDIRECTDRAWSURFACE7 src, LPRECT rSrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
|
||||
{
|
||||
DDHAL_BLTDATA mDdBlt;
|
||||
IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
|
||||
IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
|
||||
|
||||
//IDirectDrawSurfaceImpl* That = (IDirectDrawSurfaceImpl*)src;
|
||||
|
||||
if (This==NULL)
|
||||
{
|
||||
return DD_FALSE;
|
||||
}
|
||||
|
||||
if (!(This->owner->mDDrawGlobal.lpDDCBtmp->HALDDSurface.dwFlags & DDHAL_SURFCB32_BLT))
|
||||
{
|
||||
return DDERR_NODRIVERSUPPORT;
|
||||
}
|
||||
|
||||
mDdBlt.lpDDDestSurface = This->owner->mpPrimaryLocals[0];
|
||||
mDdBlt.lpDDDestSurface = This->Surf->mpPrimaryLocals[0];
|
||||
|
||||
if (!DdResetVisrgn(This->owner->mpPrimaryLocals[0], NULL))
|
||||
if (!DdResetVisrgn(This->Surf->mpPrimaryLocals[0], NULL))
|
||||
{
|
||||
return DDERR_NOGDI;
|
||||
}
|
||||
|
@ -266,11 +273,11 @@ HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rDest,
|
|||
|
||||
mDdBlt.lpDD = &This->owner->mDDrawGlobal;
|
||||
mDdBlt.Blt = This->owner->mCallbacks.HALDDSurface.Blt;
|
||||
mDdBlt.lpDDDestSurface = This->owner->mpPrimaryLocals[0];
|
||||
mDdBlt.lpDDDestSurface = This->Surf->mpPrimaryLocals[0];
|
||||
|
||||
mDdBlt.dwFlags = dwFlags;
|
||||
|
||||
This->owner->mpPrimaryLocals[0]->hDC = This->owner->mDDrawGlobal.lpExclusiveOwner->hDC;
|
||||
This->Surf->mpPrimaryLocals[0]->hDC = This->owner->mDDrawGlobal.lpExclusiveOwner->hDC;
|
||||
|
||||
// FIXME dectect if it clipped or not
|
||||
mDdBlt.IsClipped = FALSE;
|
||||
|
|
|
@ -232,6 +232,7 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
|
|||
LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter)
|
||||
{
|
||||
HRESULT ret;
|
||||
DxSurf *surf;
|
||||
|
||||
if (pUnkOuter!=NULL)
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
@ -252,10 +253,21 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
|
|||
}
|
||||
ZeroMemory(That, sizeof(IDirectDrawSurfaceImpl));
|
||||
|
||||
surf = (DxSurf*)HeapAlloc(GetProcessHeap(), 0, sizeof(DxSurf));
|
||||
|
||||
if (surf == NULL)
|
||||
{
|
||||
// FIXME Free memmory at exit
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
||||
|
||||
That->lpVtbl = &DirectDrawSurface7_Vtable;
|
||||
That->lpVtbl_v3 = &DDRAW_IDDS3_Thunk_VTable;
|
||||
*ppSurf = (LPDIRECTDRAWSURFACE7)That;
|
||||
|
||||
// FIXME free This->mDDrawGlobal.dsList on release
|
||||
This->mDDrawGlobal.dsList = (LPDDRAWI_DDRAWSURFACE_INT)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(DDRAWI_DDRAWSURFACE_INT));
|
||||
That->owner = (IDirectDrawImpl *)This;
|
||||
|
@ -264,19 +276,19 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
|
|||
/* we alwasy set to use the DirectDrawSurface7_Vtable as internel */
|
||||
That->owner->mDDrawGlobal.dsList->lpVtbl = (PVOID) &DirectDrawSurface7_Vtable;
|
||||
|
||||
|
||||
|
||||
|
||||
That->Surf = surf;
|
||||
|
||||
if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CREATESURFACE)
|
||||
{
|
||||
ret = Hal_DirectDraw_CreateSurface (iface, pDDSD, ppSurf, pUnkOuter);
|
||||
ret = Hal_DirectDraw_CreateSurface (iface, pDDSD, That, pUnkOuter);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = Hel_DirectDraw_CreateSurface (iface, pDDSD, ppSurf, pUnkOuter);
|
||||
}
|
||||
|
||||
This->mDDrawGlobal.dsList = (LPDDRAWI_DDRAWSURFACE_INT)&This->mPrimaryLocal;
|
||||
//This->mDDrawGlobal.dsList = (LPDDRAWI_DDRAWSURFACE_INT)&This->mPrimaryLocal;
|
||||
|
||||
// the real surface object creation
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef struct
|
|||
DDRAWI_DDRAWSURFACE_GBL mPrimaryGlobal;
|
||||
DDRAWI_DDRAWSURFACE_MORE mPrimaryMore;
|
||||
DDRAWI_DDRAWSURFACE_LCL mPrimaryLocal;
|
||||
DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
|
||||
//DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
|
||||
DDRAWI_DDRAWCLIPPER_LCL mPrimaryClipperLocal;
|
||||
DDRAWI_DDRAWCLIPPER_GBL mPrimaryClipperGlobal;
|
||||
//DDRAWI_DDRAWCLIPPER_INT mPrimaryClipperInterface;
|
||||
|
@ -76,6 +76,10 @@ typedef struct
|
|||
} IDirectDrawImpl;
|
||||
|
||||
/******** Surface Object ********/
|
||||
typedef struct
|
||||
{
|
||||
DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
|
||||
} DxSurf;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -90,8 +94,14 @@ typedef struct
|
|||
DDRAWI_DDRAWSURFACE_LCL *pLocal[2];
|
||||
DDSURFACEDESC ddsd;
|
||||
|
||||
DxSurf *Surf;
|
||||
|
||||
} IDirectDrawSurfaceImpl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******** Clipper Object ********/
|
||||
|
||||
typedef struct
|
||||
|
@ -142,7 +152,7 @@ HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 , LPDWORD );
|
|||
HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 );
|
||||
HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7, DWORD, DWORD, DWORD, DWORD, DWORD );
|
||||
HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7, LPRECT, LPDIRECTDRAWSURFACE7, LPRECT, DWORD, LPDDBLTFX );
|
||||
HRESULT Hal_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD, LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter);
|
||||
HRESULT Hal_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD, IDirectDrawSurfaceImpl *ppSurf, IUnknown *pUnkOuter);
|
||||
|
||||
|
||||
HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue