Author: greatlrd
Date: Fri Apr 7 20:16:34 2006
New Revision: 21508
URL:
http://svn.reactos.ru/svn/reactos?rev=21508&view=rev
Log:
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
Modified:
trunk/reactos/dll/directx/ddraw/hal/surface_hal.c
trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
trunk/reactos/dll/directx/ddraw/rosdraw.h
Modified: trunk/reactos/dll/directx/ddraw/hal/surface_hal.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/directx/ddraw/hal/surfa…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/hal/surface_hal.c (original)
+++ trunk/reactos/dll/directx/ddraw/hal/surface_hal.c Fri Apr 7 20:16:34 2006
@@ -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 @@
*/
//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 @@
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 @@
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];
-
- if (!DdResetVisrgn(This->owner->mpPrimaryLocals[0], NULL))
+ mDdBlt.lpDDDestSurface = This->Surf->mpPrimaryLocals[0];
+
+ if (!DdResetVisrgn(This->Surf->mpPrimaryLocals[0], NULL))
{
return DDERR_NOGDI;
}
@@ -266,11 +273,11 @@
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;
Modified: trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
URL:
http://svn.reactos.ru/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 Fri Apr 7 20:16:34 2006
@@ -232,6 +232,7 @@
LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown
*pUnkOuter)
{
HRESULT ret;
+ DxSurf *surf;
if (pUnkOuter!=NULL)
return DDERR_INVALIDPARAMS;
@@ -252,10 +253,21 @@
}
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 @@
/* 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
Modified: trunk/reactos/dll/directx/ddraw/rosdraw.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/directx/ddraw/rosdraw.h…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/rosdraw.h (original)
+++ trunk/reactos/dll/directx/ddraw/rosdraw.h Fri Apr 7 20:16:34 2006
@@ -50,7 +50,7 @@
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 @@
} IDirectDrawImpl;
/******** Surface Object ********/
+typedef struct
+{
+ DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
+} DxSurf;
typedef struct
{
@@ -90,7 +94,13 @@
DDRAWI_DDRAWSURFACE_LCL *pLocal[2];
DDSURFACEDESC ddsd;
+ DxSurf *Surf;
+
} IDirectDrawSurfaceImpl;
+
+
+
+
/******** Clipper Object ********/
@@ -142,7 +152,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_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 );