Implement IDirectDrawSurface::Blt for HAL

svn path=/trunk/; revision=18884
This commit is contained in:
Maarten Bosma 2005-10-30 15:34:03 +00:00
parent c1245552ab
commit c515c8db37
3 changed files with 32 additions and 33 deletions

View file

@ -10,30 +10,31 @@
#include "rosdraw.h" #include "rosdraw.h"
HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst, HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rDest,
LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx) LPDIRECTDRAWSURFACE7 src, LPRECT rSrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
{ {
IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
IDirectDrawSurfaceImpl* That = (IDirectDrawSurfaceImpl*)src;
DDHAL_BLTDATA BltData; if (!(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.dwFlags & DDHAL_SURFCB32_BLT))
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.dwFlags & DDHAL_SURFCB32_BLT))
{ {
return DDERR_NODRIVERSUPPORT; return DDERR_NODRIVERSUPPORT;
} }
BltData.lpDD = &This->DirectDrawGlobal; DDHAL_BLTDATA BltData;
/* RtlCopyMemory( &BltData.bltFX, lpbltfx,sizeof(DDBLTFX)); */ BltData.lpDD = &This->owner->DirectDrawGlobal;
BltData.dwFlags = dwFlags; BltData.dwFlags = dwFlags;
BltData.lpDDDestSurface = This->local;
if(rDest) BltData.rDest = *(RECTL*)rDest;
if(rSrc) BltData.rSrc = *(RECTL*)rSrc;
if(That) BltData.lpDDSrcSurface = That->local;
if(lpbltfx) BltData.bltFX = *lpbltfx;
/* FIXME blt is not complete */ if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.Blt(&BltData) != DDHAL_DRIVER_HANDLED)
if (This->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.Blt(&BltData) != DDHAL_DRIVER_HANDLED)
{ {
return DDERR_NODRIVERSUPPORT; return DDERR_NODRIVERSUPPORT;
} }
return BltData.ddRVal; return BltData.ddRVal;
} }

View file

@ -41,38 +41,33 @@ HRESULT WINAPI Main_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIREC
return CanCreateData.ddRVal; return CanCreateData.ddRVal;
} }
/* down here we got a crach */
/* surface global struct */ /* surface global struct */
DDRAWI_DDRAWSURFACE_GBL Global; memset(&This->Global, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
memset(&Global, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL)); This->Global.lpDD = &This->owner->DirectDrawThis->Global;
Global.lpDD = &This->owner->DirectDrawGlobal; This->Global.wHeight = This->owner->Height;
Global.wHeight = This->owner->Height; This->Global.wWidth = This->owner->Width;
Global.wWidth = This->owner->Width; This->Global.dwLinearSize = This->Global.wWidth * This->owner->Bpp/8;
Global.dwLinearSize = Global.wWidth * This->owner->Bpp/8;
/* surface more struct */ /* surface more struct */
DDRAWI_DDRAWSURFACE_MORE More; memset(&This->More, 0, sizeof(DDRAWI_DDRAWSURFACE_MORE));
memset(&More, 0, sizeof(DDRAWI_DDRAWSURFACE_MORE)); This->More.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
More.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
/* surface local struct */ /* surface local struct */
DDRAWI_DDRAWSURFACE_LCL Local; memset(&This->Local, 0, sizeof(DDRAWI_DDRAWSURFACE_LCL));
memset(&Local, 0, sizeof(DDRAWI_DDRAWSURFACE_LCL)); This->Local.lpGbl = &This->Global;
Local.lpGbl = &Global; This->Local.lpSurfMore = &This->More;
Local.lpSurfMore = &More; This->Local.ddsCaps = *(DDSCAPS*)&pDDSD->ddsCaps;
Local.ddsCaps = *(DDSCAPS*)&pDDSD->ddsCaps;
/* we need to set some flags if we create the primary surface */ /* we need to set some flags if we create the primary surface */
if(pDDSD->ddsCaps.dwCaps == DDSCAPS_PRIMARYSURFACE) if(pDDSD->ddsCaps.dwCaps == DDSCAPS_PRIMARYSURFACE)
{ {
Local.dwFlags |= DDRAWISURF_FRONTBUFFER; This->Local.dwFlags |= DDRAWISURF_FRONTBUFFER;
Global.dwGlobalFlags |= DDRAWISURFGBL_ISGDISURFACE; This->Global.dwGlobalFlags |= DDRAWISURFGBL_ISGDISURFACE;
} }
/* for the double pointer below */ /* for the double pointer below */
DDRAWI_DDRAWSURFACE_LCL *pLocal[2]; DDRAWI_DDRAWSURFACE_LCL *pLocal[2];
pLocal[0] = &Local; pLocal[0] = &This->Local;
pLocal[1] = NULL; // we need this one for bad written drivers pLocal[1] = NULL; // we need this one for bad written drivers
/* the parameter struct */ /* the parameter struct */
@ -84,7 +79,6 @@ HRESULT WINAPI Main_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIREC
CreateData.lplpSList = pLocal; CreateData.lplpSList = pLocal;
/* this is the call we were waiting for */ /* this is the call we were waiting for */
MessageBox(0,0,0,0);
if(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.CreateSurface(&CreateData) == DDHAL_DRIVER_NOTHANDLED) if(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.CreateSurface(&CreateData) == DDHAL_DRIVER_NOTHANDLED)
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;

View file

@ -41,6 +41,10 @@ typedef struct
LONG ref; LONG ref;
DDRAWI_DDRAWSURFACE_GBL Global;
DDRAWI_DDRAWSURFACE_MORE More;
DDRAWI_DDRAWSURFACE_LCL Local;
IDirectDrawImpl* owner; IDirectDrawImpl* owner;
} IDirectDrawSurfaceImpl; } IDirectDrawSurfaceImpl;