Modified: trunk/reactos/lib/ddraw/hal/surface_hal.c
Modified: trunk/reactos/lib/ddraw/main/surface_main.c
Modified: trunk/reactos/lib/ddraw/rosdraw.h
Modified: trunk/reactos/lib/ddraw/soft/surface_hel.c
--- trunk/reactos/lib/ddraw/hal/surface_hal.c 2005-11-01 17:01:36 UTC (rev 18933)
+++ trunk/reactos/lib/ddraw/hal/surface_hal.c 2005-11-01 18:27:09 UTC (rev 18934)
@@ -10,6 +10,112 @@
#include "rosdraw.h"
+HRESULT Hal_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAW pDD, LPDDSURFACEDESC2 pDDSD2)
+{
+ IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
+
+ if(sizeof(DDSURFACEDESC2) != pDDSD2->dwSize)
+ return DDERR_UNSUPPORTED;
+
+ This->owner = (IDirectDrawImpl*)pDD;
+
+ /************ fill the discription of our primary surface ***********************/
+ memset (&This->ddsd, 0, sizeof(DDSURFACEDESC));
+ This->ddsd.dwSize = sizeof(DDSURFACEDESC);
+
+ RtlCopyMemory(&This->ddsd.ddckCKDestBlt,&pDDSD2->ddckCKDestBlt,sizeof(This->ddsd.ddckCKDestBlt));
+ RtlCopyMemory(&This->ddsd.ddckCKDestOverlay,&pDDSD2->ddckCKDestOverlay,sizeof(This->ddsd.ddckCKDestOverlay));
+ RtlCopyMemory(&This->ddsd.ddckCKSrcBlt,&pDDSD2->ddckCKSrcBlt,sizeof(This->ddsd.ddckCKSrcBlt));
+ RtlCopyMemory(&This->ddsd.ddckCKSrcOverlay,&pDDSD2->ddckCKSrcOverlay,sizeof(This->ddsd.ddckCKSrcOverlay));
+ RtlCopyMemory(&This->ddsd.ddpfPixelFormat,&pDDSD2->ddpfPixelFormat,sizeof(This->ddsd.ddpfPixelFormat));
+ RtlCopyMemory(&This->ddsd.ddsCaps,&pDDSD2->ddsCaps,sizeof(This->ddsd.ddsCaps));
+
+ This->ddsd.dwAlphaBitDepth = pDDSD2->dwAlphaBitDepth;
+ This->ddsd.dwBackBufferCount = pDDSD2->dwBackBufferCount;
+ This->ddsd.dwFlags = pDDSD2->dwFlags;
+ This->ddsd.dwHeight = pDDSD2->dwHeight;
+ This->ddsd.dwLinearSize = pDDSD2->dwLinearSize;
+ This->ddsd.dwMipMapCount = pDDSD2->dwMipMapCount;
+ This->ddsd.dwRefreshRate = pDDSD2->dwRefreshRate;
+ This->ddsd.dwReserved = pDDSD2->dwReserved;
+ This->ddsd.dwWidth = pDDSD2->dwWidth;
+ This->ddsd.lPitch = pDDSD2->lPitch;
+ This->ddsd.lpSurface = pDDSD2->lpSurface;
+
+ /************ Test see if we can Create Surface ***********************/
+ if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CANCREATESURFACE)
+ {
+ /* can the driver create the surface */
+ DDHAL_CANCREATESURFACEDATA CanCreateData;
+ memset(&CanCreateData, 0, sizeof(DDHAL_CANCREATESURFACEDATA));
+ CanCreateData.lpDD = &This->owner->DirectDrawGlobal;
+ CanCreateData.lpDDSurfaceDesc = (LPDDSURFACEDESC)&This->ddsd;
+
+ if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.CanCreateSurface(&CanCreateData) == DDHAL_DRIVER_NOTHANDLED)
+ return DDERR_INVALIDPARAMS;
+
+ if(CanCreateData.ddRVal != DD_OK)
+ return CanCreateData.ddRVal;
+ }
+
+ /************ Create Surface ***********************/
+
+ /* FIXME we are skipping filling in some data, I do not care for now */
+
+ LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal = &This->owner->DirectDrawGlobal;
+ This->ddsd.dwFlags = DDSD_CAPS;
+ This->ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+
+ /* surface global struct */
+ memset(&This->Global, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
+ This->Global.lpDD = &This->owner->DirectDrawGlobal;
+ This->Global.wHeight = This->owner->DirectDrawGlobal.vmiData.dwDisplayHeight;
+ This->Global.wWidth = This->owner->DirectDrawGlobal.vmiData.dwDisplayWidth;
+ This->Global.dwLinearSize = This->owner->DirectDrawGlobal.vmiData.lDisplayPitch;
+
+
+ /* surface more struct */
+ memset(&This->More, 0, sizeof(DDRAWI_DDRAWSURFACE_MORE));
+ This->More.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
+
+ /* surface local struct */
+
+ memset(&This->Local, 0, sizeof(DDRAWI_DDRAWSURFACE_LCL));
+ This->Local.lpGbl = &This->Global;
+ This->Local.lpSurfMore = &This->More;
+
+ /* FIXME do a memcopy */
+ This->Local.ddsCaps = *(DDSCAPS*)&This->ddsd.ddsCaps;
+
+ /* for the double pointer below */
+ DDRAWI_DDRAWSURFACE_LCL *pLocal[2];
+ pLocal[0] = &This->Local;
+ pLocal[1] = NULL;
+
+ /* the parameter struct */
+ DDHAL_CREATESURFACEDATA CreateData;
+ memset(&CreateData, 0, sizeof(DDHAL_CREATESURFACEDATA));
+ CreateData.lpDD = pDirectDrawGlobal;
+ CreateData.lpDDSurfaceDesc = (LPDDSURFACEDESC) &This->ddsd;
+ CreateData.dwSCnt = 1;
+ CreateData.lplpSList = pLocal;
+ CreateData.ddRVal = DD_FALSE;
+
+ /* this is the call we were waiting for */
+ if(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.CreateSurface(&CreateData) == DDHAL_DRIVER_NOTHANDLED)
+ return DDERR_INVALIDPARAMS;
+
+ /* FIXME remove the if and debug string*/
+ if(CreateData.ddRVal != DD_OK)
+ return CreateData.ddRVal;
+
+ OutputDebugString(L"This does hit By Ati Readon but not for nvida :( ");
+ OutputDebugString(L"Yet ;)");
+
+ return DD_OK;
+}
+
+
HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rDest,
LPDIRECTDRAWSURFACE7 src, LPRECT rSrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
{
--- trunk/reactos/lib/ddraw/main/surface_main.c 2005-11-01 17:01:36 UTC (rev 18933)
+++ trunk/reactos/lib/ddraw/main/surface_main.c 2005-11-01 18:27:09 UTC (rev 18934)
@@ -13,107 +13,16 @@
HRESULT WINAPI Main_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAW pDD, LPDDSURFACEDESC2 pDDSD2)
{
- IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
+ IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
- if(sizeof(DDSURFACEDESC2) != pDDSD2->dwSize)
- return DDERR_UNSUPPORTED;
+ /* Call the Hal CreateSurface */
+ if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CREATESURFACE)
+ {
+ return Hal_DDrawSurface_Initialize (iface, pDD, pDDSD2);
+ }
- This->owner = (IDirectDrawImpl*)pDD;
-
- /************ fill the discription of our primary surface ***********************/
- memset (&This->ddsd, 0, sizeof(DDSURFACEDESC));
- This->ddsd.dwSize = sizeof(DDSURFACEDESC);
-
- RtlCopyMemory(&This->ddsd.ddckCKDestBlt,&pDDSD2->ddckCKDestBlt,sizeof(This->ddsd.ddckCKDestBlt));
- RtlCopyMemory(&This->ddsd.ddckCKDestOverlay,&pDDSD2->ddckCKDestOverlay,sizeof(This->ddsd.ddckCKDestOverlay));
- RtlCopyMemory(&This->ddsd.ddckCKSrcBlt,&pDDSD2->ddckCKSrcBlt,sizeof(This->ddsd.ddckCKSrcBlt));
- RtlCopyMemory(&This->ddsd.ddckCKSrcOverlay,&pDDSD2->ddckCKSrcOverlay,sizeof(This->ddsd.ddckCKSrcOverlay));
- RtlCopyMemory(&This->ddsd.ddpfPixelFormat,&pDDSD2->ddpfPixelFormat,sizeof(This->ddsd.ddpfPixelFormat));
- RtlCopyMemory(&This->ddsd.ddsCaps,&pDDSD2->ddsCaps,sizeof(This->ddsd.ddsCaps));
-
- This->ddsd.dwAlphaBitDepth = pDDSD2->dwAlphaBitDepth;
- This->ddsd.dwBackBufferCount = pDDSD2->dwBackBufferCount;
- This->ddsd.dwFlags = pDDSD2->dwFlags;
- This->ddsd.dwHeight = pDDSD2->dwHeight;
- This->ddsd.dwLinearSize = pDDSD2->dwLinearSize;
- This->ddsd.dwMipMapCount = pDDSD2->dwMipMapCount;
- This->ddsd.dwRefreshRate = pDDSD2->dwRefreshRate;
- This->ddsd.dwReserved = pDDSD2->dwReserved;
- This->ddsd.dwWidth = pDDSD2->dwWidth;
- This->ddsd.lPitch = pDDSD2->lPitch;
- This->ddsd.lpSurface = pDDSD2->lpSurface;
-
- /************ Test see if we can Create Surface ***********************/
- if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CANCREATESURFACE)
- {
- /* can the driver create the surface */
- DDHAL_CANCREATESURFACEDATA CanCreateData;
- memset(&CanCreateData, 0, sizeof(DDHAL_CANCREATESURFACEDATA));
- CanCreateData.lpDD = &This->owner->DirectDrawGlobal;
- CanCreateData.lpDDSurfaceDesc = (LPDDSURFACEDESC)&This->ddsd;
-
- if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.CanCreateSurface(&CanCreateData) == DDHAL_DRIVER_NOTHANDLED)
- return DDERR_INVALIDPARAMS;
-
- if(CanCreateData.ddRVal != DD_OK)
- return CanCreateData.ddRVal;
- }
-
- /************ Create Surface ***********************/
-
- /* FIXME we are skipping filling in some data, I do not care for now */
-
- LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal = &This->owner->DirectDrawGlobal;
- This->ddsd.dwFlags = DDSD_CAPS;
- This->ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
- /* surface global struct */
- memset(&This->Global, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
- This->Global.lpDD = &This->owner->DirectDrawGlobal;
- This->Global.wHeight = This->owner->DirectDrawGlobal.vmiData.dwDisplayHeight;
- This->Global.wWidth = This->owner->DirectDrawGlobal.vmiData.dwDisplayWidth;
- This->Global.dwLinearSize = This->owner->DirectDrawGlobal.vmiData.lDisplayPitch;
-
-
- /* surface more struct */
- memset(&This->More, 0, sizeof(DDRAWI_DDRAWSURFACE_MORE));
- This->More.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
-
- /* surface local struct */
-
- memset(&This->Local, 0, sizeof(DDRAWI_DDRAWSURFACE_LCL));
- This->Local.lpGbl = &This->Global;
- This->Local.lpSurfMore = &This->More;
-
- /* FIXME do a memcopy */
- This->Local.ddsCaps = *(DDSCAPS*)&This->ddsd.ddsCaps;
-
- /* for the double pointer below */
- DDRAWI_DDRAWSURFACE_LCL *pLocal[2];
- pLocal[0] = &This->Local;
- pLocal[1] = NULL;
-
- /* the parameter struct */
- DDHAL_CREATESURFACEDATA CreateData;
- memset(&CreateData, 0, sizeof(DDHAL_CREATESURFACEDATA));
- CreateData.lpDD = pDirectDrawGlobal;
- CreateData.lpDDSurfaceDesc = (LPDDSURFACEDESC) &This->ddsd;
- CreateData.dwSCnt = 1;
- CreateData.lplpSList = pLocal;
- CreateData.ddRVal = DD_FALSE;
-
- /* this is the call we were waiting for */
- if(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.CreateSurface(&CreateData) == DDHAL_DRIVER_NOTHANDLED)
- return DDERR_INVALIDPARAMS;
-
- /* FIXME remove the if and debug string*/
- if(CreateData.ddRVal != DD_OK)
- return CreateData.ddRVal;
-
- OutputDebugString(L"This does hit By Ati Readon but not for nvida :( ");
- OutputDebugString(L"Yet ;)");
-
- return DD_OK;
+ /* Call Hel if Hal of CreateSurface is not supported */
+ return Hel_DDrawSurface_Initialize (iface, pDD, pDDSD2);
}
ULONG WINAPI Main_DDrawSurface_AddRef(LPDIRECTDRAWSURFACE7 iface)
--- trunk/reactos/lib/ddraw/rosdraw.h 2005-11-01 17:01:36 UTC (rev 18933)
+++ trunk/reactos/lib/ddraw/rosdraw.h 2005-11-01 18:27:09 UTC (rev 18934)
@@ -97,6 +97,7 @@
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_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 , LPDIRECTDRAW , LPDDSURFACEDESC2 );
HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 );
@@ -108,6 +109,7 @@
HRESULT Hel_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 );
HRESULT Hel_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 , DWORD , DWORD ,DWORD , DWORD , DWORD );
HRESULT Hel_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7, LPRECT, LPDIRECTDRAWSURFACE7, LPRECT, DWORD, LPDDBLTFX );
+HRESULT Hel_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 , LPDIRECTDRAW , LPDDSURFACEDESC2 );
/*********** Macros ***********/
--- trunk/reactos/lib/ddraw/soft/surface_hel.c 2005-11-01 17:01:36 UTC (rev 18933)
+++ trunk/reactos/lib/ddraw/soft/surface_hel.c 2005-11-01 18:27:09 UTC (rev 18934)
@@ -10,6 +10,11 @@
#include "rosdraw.h"
+HRESULT Hel_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAW pDD, LPDDSURFACEDESC2 pDDSD2)
+{
+ DX_STUB;
+}
+
HRESULT Hel_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
{