From 1eade84bbf7b7fc2a3b5c1f8b8271fb8a246cf50 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Mon, 1 May 2006 10:04:59 +0000 Subject: [PATCH] Working on a redesign of whole directdraw interface frist commit of many svn path=/trunk/; revision=21760 --- reactos/dll/directx/ddraw/clipper.c | 132 ++++++++++++++++++ reactos/dll/directx/ddraw/ddraw.rbuild | 5 +- reactos/dll/directx/ddraw/main/clipper_main.c | 78 ----------- reactos/dll/directx/ddraw/main/ddraw_main.c | 9 +- reactos/dll/directx/ddraw/rosdraw.h | 74 +++++++++- 5 files changed, 214 insertions(+), 84 deletions(-) create mode 100644 reactos/dll/directx/ddraw/clipper.c delete mode 100644 reactos/dll/directx/ddraw/main/clipper_main.c diff --git a/reactos/dll/directx/ddraw/clipper.c b/reactos/dll/directx/ddraw/clipper.c new file mode 100644 index 00000000000..b50ac67560a --- /dev/null +++ b/reactos/dll/directx/ddraw/clipper.c @@ -0,0 +1,132 @@ +/* $Id$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS + * FILE: lib/ddraw/main/clipper.c + * PURPOSE: IDirectDrawClipper Implementation + * PROGRAMMER: Maarten Bosma + * + */ + +#include "rosdraw.h" + + +ULONG WINAPI +DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) +{ + DX_WINDBG_trace(); + + IDirectDrawClipperImpl* This = (IDirectDrawClipperImpl*)iface; + ULONG ref=0; + + if (iface!=NULL) + { + ref = InterlockedDecrement( (PLONG) &This->ref); + + if (ref == 0) + { + /* Add here if we need releae some memory pointer before + * exists + */ + + if (This!=NULL) + { + HeapFree(GetProcessHeap(), 0, This); + } + } + } + return ref; +} + +ULONG WINAPI +DirectDrawClipper_AddRef (LPDIRECTDRAWCLIPPER iface) +{ + DX_WINDBG_trace(); + + IDirectDrawClipperImpl * This = (IDirectDrawClipperImpl*)iface; + + ULONG ref=0; + + if (iface!=NULL) + { + ref = InterlockedIncrement( (PLONG) &This->ref); + } + return ref; +} + +HRESULT WINAPI +DirectDrawClipper_Initialize( LPDIRECTDRAWCLIPPER iface, + LPDIRECTDRAW lpDD, + DWORD dwFlags) +{ + /* FIXME not implment */ + DX_WINDBG_trace(); + DX_STUB_DD_OK; +} + +HRESULT WINAPI +DirectDrawClipper_SetHwnd( LPDIRECTDRAWCLIPPER iface, + DWORD dwFlags, + HWND hWnd) +{ + /* FIXME not implment */ + DX_WINDBG_trace(); + DX_STUB_DD_OK; +} + +HRESULT WINAPI +DirectDrawClipper_GetClipList( LPDIRECTDRAWCLIPPER iface, + LPRECT lpRect, + LPRGNDATA lpClipList, + LPDWORD lpdwSize) +{ + DX_WINDBG_trace(); + DX_STUB; +} + +HRESULT WINAPI +DirectDrawClipper_SetClipList( LPDIRECTDRAWCLIPPER iface, + LPRGNDATA lprgn, + DWORD dwFlag) +{ + DX_WINDBG_trace(); + DX_STUB; +} + +HRESULT WINAPI +DirectDrawClipper_QueryInterface( LPDIRECTDRAWCLIPPER iface, + REFIID riid, + LPVOID* ppvObj) +{ + DX_WINDBG_trace(); + DX_STUB; +} + +HRESULT WINAPI +DirectDrawClipper_GetHWnd( LPDIRECTDRAWCLIPPER iface, + HWND* hWndPtr) +{ + DX_WINDBG_trace(); + DX_STUB; +} + +HRESULT WINAPI +DirectDrawClipper_IsClipListChanged( LPDIRECTDRAWCLIPPER iface, + BOOL* lpbChanged) +{ + DX_WINDBG_trace(); + DX_STUB; +} + +IDirectDrawClipperVtbl DirectDrawClipper_Vtable = +{ + DirectDrawClipper_QueryInterface, + DirectDrawClipper_AddRef, + DirectDrawClipper_Release, + DirectDrawClipper_GetClipList, + DirectDrawClipper_GetHWnd, + DirectDrawClipper_Initialize, + DirectDrawClipper_IsClipListChanged, + DirectDrawClipper_SetClipList, + DirectDrawClipper_SetHwnd +}; diff --git a/reactos/dll/directx/ddraw/ddraw.rbuild b/reactos/dll/directx/ddraw/ddraw.rbuild index 1b9bcb2cf70..9cb7224efb8 100644 --- a/reactos/dll/directx/ddraw/ddraw.rbuild +++ b/reactos/dll/directx/ddraw/ddraw.rbuild @@ -18,6 +18,8 @@ main.c regsvr.c + clipper.c + ddraw_hal.c surface_hal.c @@ -25,8 +27,7 @@ ddraw_main.c - surface_main.c - clipper_main.c + surface_main.c color_main.c gamma_main.c palette_main.c diff --git a/reactos/dll/directx/ddraw/main/clipper_main.c b/reactos/dll/directx/ddraw/main/clipper_main.c deleted file mode 100644 index 614faec5af2..00000000000 --- a/reactos/dll/directx/ddraw/main/clipper_main.c +++ /dev/null @@ -1,78 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS - * FILE: lib/ddraw/main/clipper.c - * PURPOSE: IDirectDrawClipper Implementation - * PROGRAMMER: Maarten Bosma - * - */ - -#include "rosdraw.h" - - -ULONG WINAPI Main_DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) -{ - return 0; -} - -ULONG WINAPI Main_DirectDrawClipper_AddRef (LPDIRECTDRAWCLIPPER iface) -{ - return 1; -} - -HRESULT WINAPI Main_DirectDrawClipper_Initialize( - LPDIRECTDRAWCLIPPER iface, LPDIRECTDRAW lpDD, DWORD dwFlags) -{ - return DD_OK; -} - -HRESULT WINAPI Main_DirectDrawClipper_SetHwnd( - LPDIRECTDRAWCLIPPER iface, DWORD dwFlags, HWND hWnd) -{ - DX_STUB; -} - -HRESULT WINAPI Main_DirectDrawClipper_GetClipList( - LPDIRECTDRAWCLIPPER iface, LPRECT lpRect, LPRGNDATA lpClipList, - LPDWORD lpdwSize) -{ - DX_STUB; -} - -HRESULT WINAPI Main_DirectDrawClipper_SetClipList( - LPDIRECTDRAWCLIPPER iface,LPRGNDATA lprgn,DWORD dwFlag) -{ - DX_STUB; -} - -HRESULT WINAPI Main_DirectDrawClipper_QueryInterface( - LPDIRECTDRAWCLIPPER iface, REFIID riid, LPVOID* ppvObj) -{ - return E_NOINTERFACE; -} - -HRESULT WINAPI Main_DirectDrawClipper_GetHWnd( - LPDIRECTDRAWCLIPPER iface, HWND* hWndPtr) -{ - DX_STUB; -} - -HRESULT WINAPI Main_DirectDrawClipper_IsClipListChanged( - LPDIRECTDRAWCLIPPER iface, BOOL* lpbChanged) -{ - DX_STUB; -} - -IDirectDrawClipperVtbl DirectDrawClipper_Vtable = -{ - Main_DirectDrawClipper_QueryInterface, - Main_DirectDrawClipper_AddRef, - Main_DirectDrawClipper_Release, - Main_DirectDrawClipper_GetClipList, - Main_DirectDrawClipper_GetHWnd, - Main_DirectDrawClipper_Initialize, - Main_DirectDrawClipper_IsClipListChanged, - Main_DirectDrawClipper_SetClipList, - Main_DirectDrawClipper_SetHwnd -}; diff --git a/reactos/dll/directx/ddraw/main/ddraw_main.c b/reactos/dll/directx/ddraw/main/ddraw_main.c index 1d2e3652316..e596e9df02a 100644 --- a/reactos/dll/directx/ddraw/main/ddraw_main.c +++ b/reactos/dll/directx/ddraw/main/ddraw_main.c @@ -789,13 +789,18 @@ HRESULT WINAPI Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps IDirectDrawImpl *This = (IDirectDrawImpl *)iface; if (pDriverCaps != NULL) - { + { + + + Main_DirectDraw_GetAvailableVidMem(iface, &ddscaps, &This->mDDrawGlobal.ddCaps.dwVidMemTotal, &This->mDDrawGlobal.ddCaps.dwVidMemFree); - + RtlCopyMemory(pDriverCaps,&This->mDDrawGlobal.ddCaps,sizeof(DDCORECAPS)); + pDriverCaps->dwSize=sizeof(DDCAPS); + status = DD_OK; } diff --git a/reactos/dll/directx/ddraw/rosdraw.h b/reactos/dll/directx/ddraw/rosdraw.h index 962c7330530..7423793e8db 100644 --- a/reactos/dll/directx/ddraw/rosdraw.h +++ b/reactos/dll/directx/ddraw/rosdraw.h @@ -159,6 +159,54 @@ typedef struct } IDirectDrawPaletteImpl; +/******** Gamma Object ********/ + +typedef struct +{ + IDirectDrawGammaControlVtbl* lpVtbl; + LONG ref; + IDirectDrawImpl* Owner; + IDirectDrawSurfaceImpl* Surf; + + +} IDirectDrawGammaImpl; + +/******** Color Object ********/ + +typedef struct +{ + IDirectDrawColorControlVtbl* lpVtbl; + LONG ref; + IDirectDrawImpl* Owner; + IDirectDrawSurfaceImpl* Surf; + + +} IDirectDrawColorImpl; + +/******** Kernel Object ********/ + +typedef struct +{ + IDirectDrawKernelVtbl* lpVtbl; + LONG ref; + IDirectDrawImpl* Owner; + IDirectDrawSurfaceImpl* Surf; + +} IDirectDrawKernelImpl; + +/******** SurfaceKernel Object ********/ + +typedef struct +{ + IDirectDrawSurfaceKernelVtbl* lpVtbl; + LONG ref; + IDirectDrawImpl* Owner; + IDirectDrawSurfaceImpl* Surf; + IDirectDrawKernelImpl * Kernl; + +} IDirectDrawSurfaceKernelImpl; + + /*********** VTables ************/ extern IDirectDraw7Vtbl DirectDraw7_Vtable; @@ -173,6 +221,8 @@ extern IDirectDrawPaletteVtbl DirectDrawPalette_Vtable; extern IDirectDrawClipperVtbl DirectDrawClipper_Vtable; extern IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable; extern IDirectDrawGammaControlVtbl DirectDrawGammaControl_Vtable; +extern IDirectDrawKernelVtbl DirectDrawKernel_Vtable; +extern IDirectDrawSurfaceKernelVtbl DirectDrawSurfaceKernel_Vtable; /********* Prototypes **********/ @@ -211,8 +261,16 @@ HRESULT Hel_DDrawSurface_Flip(LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAWSURFACE7 o HRESULT Hel_DDrawSurface_UpdateOverlayDisplay (LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags); /* HEL CALLBACK */ -DWORD CALLBACK HelDdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA pccsd); -DWORD CALLBACK HelDdCreateSurface(LPDDHAL_CREATESURFACEDATA lpCreateSurface); +DWORD CALLBACK HelDdDestroyDriver(LPDDHAL_DESTROYDRIVERDATA lpDestroyDriver); +DWORD CALLBACK HelDdCreateSurface(LPDDHAL_CREATESURFACEDATA lpCreateSurface); +DWORD CALLBACK HelDdSetColorKey(LPDDHAL_SETCOLORKEYDATA lpSetColorKey); +DWORD CALLBACK HelDdSetMode(LPDDHAL_SETMODEDATA SetMode); +DWORD CALLBACK HelDdWaitForVerticalBlank(LPDDHAL_WAITFORVERTICALBLANKDATA lpWaitForVerticalBlank); +DWORD CALLBACK HelDdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA lpCanCreateSurface); +DWORD CALLBACK HelDdCreatePalette(LPDDHAL_CREATEPALETTEDATA lpCreatePalette); +DWORD CALLBACK HelDdGetScanLine(LPDDHAL_GETSCANLINEDATA lpGetScanLine); +DWORD CALLBACK HelDdSetExclusiveMode(LPDDHAL_SETEXCLUSIVEMODEDATA lpSetExclusiveMode); +DWORD CALLBACK HelDdFlipToGDISurface(LPDDHAL_FLIPTOGDISURFACEDATA lpFlipToGDISurface); /* Setting for HEL should be move to ros special reg key ? */ @@ -232,6 +290,18 @@ DWORD CALLBACK HelDdCreateSurface(LPDDHAL_CREATESURFACEDATA lpCreateSurface); firstcall = FALSE; \ } \ return DDERR_UNSUPPORTED; + +#define DX_STUB_DD_OK \ + static BOOL firstcall = TRUE; \ + if (firstcall) \ + { \ + char buffer[1024]; \ + sprintf ( buffer, "Function %s is not implemented yet (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \ + OutputDebugStringA(buffer); \ + firstcall = FALSE; \ + } \ + return DD_OK; + #define DX_STUB_str(x) \ static BOOL firstcall = TRUE; \ -- 2.17.1