Author: greatlrd
Date: Sun Apr 9 21:05:57 2006
New Revision: 21533
URL:
http://svn.reactos.ru/svn/reactos?rev=21533&view=rev
Log:
Implement GetSurfaceDesc
Modified:
trunk/reactos/dll/directx/ddraw/hal/surface_hal.c
trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
trunk/reactos/dll/directx/ddraw/main/surface_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 Sun Apr 9 21:05:57 2006
@@ -13,7 +13,7 @@
HRESULT Hal_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
IDirectDrawSurfaceImpl *ppSurf, IUnknown *pUnkOuter)
{
- //UINT i;
+ // UINT i;
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
IDirectDrawSurfaceImpl* That = ppSurf;
@@ -101,26 +101,26 @@
}
else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_OVERLAY)
{
- DX_STUB_str( "Can not create overlay surface");
- ////memset(&This->mddsdOverlay, 0, sizeof(DDSURFACEDESC));
- //memcpy(&This->mddsdOverlay,pDDSD,sizeof(DDSURFACEDESC));
- //This->mddsdOverlay.dwSize = sizeof(DDSURFACEDESC);
- ////This->mddsdOverlay.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT |
DDSD_BACKBUFFERCOUNT | DDSD_WIDTH | DDSD_HEIGHT;
-
- ////This->mddsdOverlay.ddsCaps.dwCaps = DDSCAPS_OVERLAY |
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
-
- ////This->mddsdOverlay.dwWidth = 100; //pels;
- ////This->mddsdOverlay.dwHeight = 100; // lines;
- ////This->mddsdOverlay.dwBackBufferCount = 1; //cBuffers;
-
- ////This->mddsdOverlay.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
- ////This->mddsdOverlay.ddpfPixelFormat.dwFlags = DDPF_RGB;
- ////This->mddsdOverlay.ddpfPixelFormat.dwRGBBitCount = 32;
+ // DX_STUB_str( "Can not create overlay surface");
+ // memset(&That->Surf->mddsdOverlay, 0, sizeof(DDSURFACEDESC));
+ // memcpy(&That->Surf->mddsdOverlay,pDDSD,sizeof(DDSURFACEDESC));
+ // That->Surf->mddsdOverlay.dwSize = sizeof(DDSURFACEDESC);
+ //That->Surf->mddsdOverlay.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT |
DDSD_BACKBUFFERCOUNT | DDSD_WIDTH | DDSD_HEIGHT;
+
+ //That->Surf->mddsdOverlay.ddsCaps.dwCaps = DDSCAPS_OVERLAY |
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
+
+ //That->Surf->mddsdOverlay.dwWidth = 100; //pels;
+ //That->Surf->mddsdOverlay.dwHeight = 100; // lines;
+ //That->Surf->mddsdOverlay.dwBackBufferCount = 1; //cBuffers;
+
+ //That->Surf->mddsdOverlay.ddpfPixelFormat.dwSize =
sizeof(DDPIXELFORMAT);
+ //That->Surf->mddsdOverlay.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ //That->Surf->mddsdOverlay.ddpfPixelFormat.dwRGBBitCount = 32;
//mDdCanCreateSurface.lpDD = &This->mDDrawGlobal;
//mDdCanCreateSurface.CanCreateSurface =
This->mCallbacks.HALDD.CanCreateSurface;
//mDdCanCreateSurface.bIsDifferentPixelFormat = TRUE;
//isDifferentPixelFormat;
- //mDdCanCreateSurface.lpDDSurfaceDesc = &This->mddsdOverlay; // pDDSD;
+ //mDdCanCreateSurface.lpDDSurfaceDesc = &That->Surf->mddsdOverlay;
// pDDSD;
//if
(This->mHALInfo.lpDDCallbacks->CanCreateSurface(&mDdCanCreateSurface)==
DDHAL_DRIVER_NOTHANDLED)
@@ -133,40 +133,40 @@
// return DDERR_NOTINITIALIZED;
//}
- //memset(&This->mOverlayGlobal, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
- //This->mOverlayGlobal.dwGlobalFlags = 0;
- //This->mOverlayGlobal.lpDD = &This->mDDrawGlobal;
- //This->mOverlayGlobal.lpDDHandle = &This->mDDrawGlobal;
- //This->mOverlayGlobal.wWidth = (WORD)This->mddsdOverlay.dwWidth;
- //This->mOverlayGlobal.wHeight = (WORD)This->mddsdOverlay.dwHeight;
- //This->mOverlayGlobal.lPitch = -1;
- //This->mOverlayGlobal.ddpfSurface =
This->mddsdOverlay.ddpfPixelFormat;
+ //memset(&That->Surf->mOverlayGlobal, 0,
sizeof(DDRAWI_DDRAWSURFACE_GBL));
+ //That->Surf->mOverlayGlobal.dwGlobalFlags = 0;
+ //That->Surf->mOverlayGlobal.lpDD = &This->mDDrawGlobal;
+ //That->Surf->mOverlayGlobal.lpDDHandle = &This->mDDrawGlobal;
+ //That->Surf->mOverlayGlobal.wWidth =
(WORD)That->Surf->mddsdOverlay.dwWidth;
+ //That->Surf->mOverlayGlobal.wHeight =
(WORD)That->Surf->mddsdOverlay.dwHeight;
+ //That->Surf->mOverlayGlobal.lPitch = -1;
+ //That->Surf->mOverlayGlobal.ddpfSurface =
That->Surf->mddsdOverlay.ddpfPixelFormat;
//// setup front- and backbuffer surfaces
- //UINT cSurfaces = This->mddsdOverlay.dwBackBufferCount + 1;
+ //UINT cSurfaces = That->Surf->mddsdOverlay.dwBackBufferCount + 1;
//for (i = 0; i < cSurfaces; i++)
//{
- // memset(&This->mOverlayMore[i], 0,
sizeof(DDRAWI_DDRAWSURFACE_MORE));
- // This->mOverlayMore[i].dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
-
- // memset(&This->mOverlayLocal[i], 0,
sizeof(DDRAWI_DDRAWSURFACE_LCL));
- // This->mOverlayLocal[i].lpGbl = &This->mOverlayGlobal;
- // This->mOverlayLocal[i].lpSurfMore = &This->mOverlayMore[i];
- // This->mOverlayLocal[i].dwProcessId = GetCurrentProcessId();
- // This->mOverlayLocal[i].dwFlags = (i == 0) ?
+ // memset(&That->Surf->mOverlayMore[i], 0,
sizeof(DDRAWI_DDRAWSURFACE_MORE));
+ // That->Surf->mOverlayMore[i].dwSize =
sizeof(DDRAWI_DDRAWSURFACE_MORE);
+
+ // memset(&That->Surf->mOverlayLocal[i], 0,
sizeof(DDRAWI_DDRAWSURFACE_LCL));
+ // That->Surf->mOverlayLocal[i].lpGbl =
&That->Surf->mOverlayGlobal;
+ // That->Surf->mOverlayLocal[i].lpSurfMore =
&That->Surf->mOverlayMore[i];
+ // That->Surf->mOverlayLocal[i].dwProcessId = GetCurrentProcessId();
+ // That->Surf->mOverlayLocal[i].dwFlags = (i == 0) ?
// (DDRAWISURF_IMPLICITROOT|DDRAWISURF_FRONTBUFFER):
// (DDRAWISURF_IMPLICITCREATE|DDRAWISURF_BACKBUFFER);
- // This->mOverlayLocal[i].dwFlags |=
DDRAWISURF_ATTACHED|DDRAWISURF_ATTACHED_FROM| DDRAWISURF_HASPIXELFORMAT|
DDRAWISURF_HASOVERLAYDATA;
-
- // This->mOverlayLocal[i].ddsCaps.dwCaps =
This->mddsdOverlay.ddsCaps.dwCaps;
- // This->mpOverlayLocals[i] = &This->mOverlayLocal[i];
+ // That->Surf->mOverlayLocal[i].dwFlags |=
DDRAWISURF_ATTACHED|DDRAWISURF_ATTACHED_FROM| DDRAWISURF_HASPIXELFORMAT|
DDRAWISURF_HASOVERLAYDATA;
+
+ // That->Surf->mOverlayLocal[i].ddsCaps.dwCaps =
That->Surf->mddsdOverlay.ddsCaps.dwCaps;
+ // That->Surf->mpOverlayLocals[i] =
&That->Surf->mOverlayLocal[i];
//}
//for (i = 0; i < cSurfaces; i++)
//{
// UINT j = (i + 1) % cSurfaces;
- // if (!DdAttachSurface(This->mpOverlayLocals[i],
This->mpOverlayLocals[j]))
+ // if (!DdAttachSurface(That->Surf->mpOverlayLocals[i],
That->Surf->mpOverlayLocals[j]))
// {
// // derr(L"DirectDrawImpl[%08x]::__setupDevice DdAttachSurface(%d,
%d) failed", this, i, j);
// return DD_FALSE;
@@ -175,8 +175,8 @@
//mDdCreateSurface.lpDD = &This->mDDrawGlobal;
//mDdCreateSurface.CreateSurface = This->mCallbacks.HALDD.CreateSurface;
- //mDdCreateSurface.lpDDSurfaceDesc = &This->mddsdOverlay;//pDDSD;
- //mDdCreateSurface.lplpSList = This->mpOverlayLocals; //cSurfaces;
+ //mDdCreateSurface.lpDDSurfaceDesc =
&That->Surf->mddsdOverlay;//pDDSD;
+ //mDdCreateSurface.lplpSList = That->Surf->mpOverlayLocals;
//cSurfaces;
//mDdCreateSurface.dwSCnt = 1 ; //ppSurfaces;
//if (This->mHALInfo.lpDDCallbacks->CreateSurface(&mDdCreateSurface)
== DDHAL_DRIVER_NOTHANDLED)
@@ -193,7 +193,7 @@
//mDdUpdateOverlay.lpDD = &This->mDDrawGlobal;
//mDdUpdateOverlay.UpdateOverlay =
This->mCallbacks.HALDDSurface.UpdateOverlay;
//mDdUpdateOverlay.lpDDDestSurface = That->Surf->mpPrimaryLocals[0];
- //mDdUpdateOverlay.lpDDSrcSurface = This->mpOverlayLocals[0];//pDDSurface;
+ //mDdUpdateOverlay.lpDDSrcSurface =
That->Surf->mpOverlayLocals[0];//pDDSurface;
//mDdUpdateOverlay.dwFlags = DDOVER_SHOW;
//mDdUpdateOverlay.rDest.top = 0;
@@ -216,7 +216,7 @@
// return mDdUpdateOverlay.ddRVal;
//}
- //return DD_OK;
+ return DD_OK;
return DDERR_INVALIDSURFACETYPE;
}
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 Sun Apr 9 21:05:57 2006
@@ -144,9 +144,7 @@
if (iface!=NULL)
{
ref = InterlockedDecrement(&This->ref);
-
- DX_WINDBG_trace_res((INT)This->mDDrawGlobal.dwRefCnt,(INT)ref,(INT)0);
-
+
if (ref == 0)
{
// set resoltion back to the one in registry
@@ -481,22 +479,19 @@
pDDSD->dwWidth = This->mDDrawGlobal.vmiData.dwDisplayWidth;
pDDSD->lPitch = This->mDDrawGlobal.vmiData.lDisplayPitch;
pDDSD->dwRefreshRate = This->mDDrawGlobal.dwMonitorFrequency;
-
+ pDDSD->dwAlphaBitDepth =
This->mDDrawGlobal.vmiData.ddpfDisplay.dwAlphaBitDepth;
+
RtlCopyMemory(&pDDSD->ddpfPixelFormat,&This->mDDrawGlobal.vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
RtlCopyMemory(&pDDSD->ddsCaps,&This->mDDrawGlobal.ddCaps,sizeof(DDCORECAPS));
+
+
RtlCopyMemory(&pDDSD->ddckCKDestOverlay,&This->mDDrawGlobal.ddckCKDestOverlay,sizeof(DDCOLORKEY));
+
RtlCopyMemory(&pDDSD->ddckCKSrcOverlay,&This->mDDrawGlobal.ddckCKSrcOverlay,sizeof(DDCOLORKEY));
/* have not check where I should get hold of this info yet
- DWORD dwBackBufferCount;
- DWORD dwAlphaBitDepth;
+ DWORD dwBackBufferCount;
DWORD dwReserved;
- LPVOID lpSurface;
- union
- {
- DDCOLORKEY ddckCKDestOverlay;
- DWORD dwEmptyFaceColor;
- }
- DDCOLORKEY ddckCKDestBlt;
- DDCOLORKEY ddckCKSrcOverlay;
+ LPVOID lpSurface;
+ DDCOLORKEY ddckCKDestBlt;
DDCOLORKEY ddckCKSrcBlt;
DWORD dwTextureStage;
*/
Modified: trunk/reactos/dll/directx/ddraw/main/surface_main.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/directx/ddraw/main/surf…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main/surface_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main/surface_main.c Sun Apr 9 21:05:57 2006
@@ -406,9 +406,24 @@
Main_DDrawSurface_GetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface,
LPDDSURFACEDESC2 pDDSD)
{
- DX_WINDBG_trace();
-
- DX_STUB;
+ DWORD dwSize;
+ DX_WINDBG_trace();
+
+ IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
+
+ dwSize = pDDSD->dwSize;
+
+ if ((dwSize != sizeof(DDSURFACEDESC)) &&
+ (dwSize != sizeof(DDSURFACEDESC2)))
+ {
+ return DDERR_GENERIC;
+ }
+
+ RtlZeroMemory(pDDSD,dwSize);
+ memcpy(pDDSD, &This->Surf->mddsdPrimary, sizeof(DDSURFACEDESC));
+ pDDSD->dwSize = dwSize;
+
+ return DD_OK;
}
HRESULT WINAPI
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 Sun Apr 9 21:05:57 2006
@@ -92,6 +92,14 @@
DDRAWI_DDRAWCLIPPER_GBL mPrimaryClipperGlobal;
DDSURFACEDESC mddsdPrimary;
+
+ DDRAWI_DDRAWSURFACE_GBL mOverlayGlobal;
+ DDRAWI_DDRAWSURFACE_LCL mOverlayLocal[6];
+ DDRAWI_DDRAWSURFACE_LCL *mpOverlayLocals[6];
+ DDRAWI_DDRAWSURFACE_MORE mOverlayMore[6];
+
+ DDSURFACEDESC mddsdOverlay;
+
} DxSurf;
typedef struct
@@ -229,7 +237,7 @@
char buffer[1024]; \
sprintf ( buffer, "Enter Function %s (%s:%d)\n",
__FUNCTION__,__FILE__,__LINE__ ); \
OutputDebugStringA(buffer); \
- firstcallx = FALSE; \
+ firstcallx = TRUE; \
}
#define DX_WINDBG_trace_res(width,height,bpp) \