Working on a redesign of whole directdraw interface
authorMagnus Olsen <magnus@greatlord.com>
Mon, 1 May 2006 10:04:59 +0000 (10:04 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Mon, 1 May 2006 10:04:59 +0000 (10:04 +0000)
frist commit of many

svn path=/trunk/; revision=21760

reactos/dll/directx/ddraw/clipper.c [new file with mode: 0644]
reactos/dll/directx/ddraw/ddraw.rbuild
reactos/dll/directx/ddraw/main/clipper_main.c [deleted file]
reactos/dll/directx/ddraw/main/ddraw_main.c
reactos/dll/directx/ddraw/rosdraw.h

diff --git a/reactos/dll/directx/ddraw/clipper.c b/reactos/dll/directx/ddraw/clipper.c
new file mode 100644 (file)
index 0000000..b50ac67
--- /dev/null
@@ -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
+};
index 1b9bcb2..9cb7224 100644 (file)
@@ -18,6 +18,8 @@
        <file>main.c</file>
        <file>regsvr.c</file>
 
+      <file>clipper.c</file>
+
        <directory name="hal">
                <file>ddraw_hal.c</file>
                <file>surface_hal.c</file>
@@ -25,8 +27,7 @@
 
        <directory name="main">
                <file>ddraw_main.c</file>
-               <file>surface_main.c</file>
-               <file>clipper_main.c</file>
+               <file>surface_main.c</file>             
                <file>color_main.c</file>
                <file>gamma_main.c</file>
                <file>palette_main.c</file>
diff --git a/reactos/dll/directx/ddraw/main/clipper_main.c b/reactos/dll/directx/ddraw/main/clipper_main.c
deleted file mode 100644 (file)
index 614faec..0000000
+++ /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
-};
index 1d2e365..e596e9d 100644 (file)
@@ -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;
     }
 
index 962c733..7423793 100644 (file)
@@ -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; \