ReactOS  0.4.14-dev-358-gbef841c
clipper_main.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS DirectX
4  * FILE: dll/directx/ddraw/Clipper/clipper_main.c
5  * PURPOSE: IDirectDrawClipper Implementation
6  * PROGRAMMER: Maarten Bosma
7  *
8  */
9 
10 #include "rosdraw.h"
11 
14  REFIID id, LPVOID *obj)
15 {
16  if(!iface)
17  return DDERR_INVALIDOBJECT;
18 
19  return E_NOINTERFACE;
20 }
21 
25 {
28 
30 
31  if(!This)
32  return DDERR_INVALIDOBJECT;
33 
34  if(This->dwIntRefCnt)
36 
38  This->dwIntRefCnt = 1;
39 
41  //This->lpLcl->lpClipMore
42  This->lpLcl->lpDD_int = DDraw;
43  This->lpLcl->lpGbl->dwRefCnt = 1;
44  This->lpLcl->pAddrefedThisOwner = (IUnknown*)DDraw;
45 
46  // FIXME: Implement Linking and share global object
47  DxHeapMemAlloc(This->lpLcl->lpGbl, sizeof(DDRAWI_DDRAWCLIPPER_GBL));
48  This->lpLcl->lpGbl->dwProcessId = GetCurrentProcessId();
49 
50  return DD_OK;
51 }
52 
55 {
57  if(!This)
58  return DDERR_INVALIDOBJECT;
59 
61 
62  if (iface!=NULL)
63  {
64  This->lpLcl->dwLocalRefCnt--;
65  This->dwIntRefCnt--;
66 
67  if (This->lpLcl->lpGbl)
68  This->lpLcl->lpGbl->dwRefCnt--;
69  }
70 
71  return This->dwIntRefCnt;
72 }
73 
76 {
78  if(!This)
79  return DDERR_INVALIDOBJECT;
80 
82 
83  if (iface!=NULL)
84  {
85  This->dwIntRefCnt++;
86  This->lpLcl->dwLocalRefCnt++;
87  if (This->lpLcl->lpGbl)
88  This->lpLcl->lpGbl->dwRefCnt++;
89  }
90  return This->dwIntRefCnt;
91 }
92 
95  DWORD dwFlags,
96  HWND hWnd)
97 {
99 
100  if(!This)
101  return DDERR_INVALIDOBJECT;
102 
103  if(!IsWindow(hWnd))
104  return DDERR_INVALIDPARAMS;
105 
106  // TODO: check flags
107 
108  This->lpLcl->lpGbl->hWnd = (ULONG_PTR)hWnd;
109  This->lpLcl->lpGbl->dwFlags = dwFlags;
110 
111  return DD_OK;
112 }
113 
116  HWND* hWndPtr)
117 {
119 
120  if(!This)
121  return DDERR_INVALIDOBJECT;
122 
123  if(!hWndPtr)
124  return DDERR_INVALIDPARAMS;
125 
126  *hWndPtr = (HWND)This->lpLcl->lpGbl->hWnd;
127 
128  return DD_OK;
129 }
130 
131 IDirectDrawClipperVtbl DirectDrawClipper_Vtable =
132 {
142 };
#define DX_WINDBG_trace()
Definition: rosdraw.h:262
HRESULT WINAPI DirectDrawClipper_SetHwnd(LPDIRECTDRAWCLIPPER iface, DWORD dwFlags, HWND hWnd)
Definition: clipper_main.c:94
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT WINAPI DirectDrawClipper_Initialize(LPDIRECTDRAWCLIPPER iface, LPDIRECTDRAW lpDD, DWORD dwFlags)
Definition: clipper_main.c:23
BOOL WINAPI IsWindow(_In_opt_ HWND)
HWND hWnd
Definition: settings.c:17
ULONG WINAPI DirectDrawClipper_AddRef(LPDIRECTDRAWCLIPPER iface)
Definition: clipper_main.c:75
HANDLE HWND
Definition: compat.h:13
HRESULT WINAPI DirectDrawClipper_GetHWnd(LPDIRECTDRAWCLIPPER iface, HWND *hWndPtr)
Definition: clipper_main.c:115
IDirectDrawClipperVtbl DirectDrawClipper_Vtable
Definition: clipper_main.c:131
#define DD_OK
Definition: ddraw.h:186
#define DDERR_INVALIDOBJECT
Definition: ddraw.h:78
struct IDirectDraw * LPDIRECTDRAW
Definition: ddraw.h:710
HRESULT WINAPI DirectDrawClipper_QueryInterface(LPDIRECTDRAWCLIPPER iface, REFIID id, LPVOID *obj)
Definition: clipper_main.c:13
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DirectDrawClipper_GetClipList(LPDIRECTDRAWCLIPPER, LPRECT, LPRGNDATA, LPDWORD)
Definition: clipper_stubs.c:13
#define DDERR_ALREADYINITIALIZED
Definition: ddraw.h:67
LONG HRESULT
Definition: typedefs.h:77
#define DxHeapMemAlloc(p, m)
Definition: rosdraw.h:113
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI DirectDrawClipper_SetClipList(LPDIRECTDRAWCLIPPER, LPRGNDATA, DWORD)
Definition: clipper_stubs.c:23
#define LPVOID
Definition: nt_native.h:45
struct _DDRAWI_DDRAWCLIPPER_INT * LPDDRAWI_DDRAWCLIPPER_INT
Definition: ddrawi.h:145
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
ULONG WINAPI DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface)
Definition: clipper_main.c:54
struct IDirectDrawClipper * LPDIRECTDRAWCLIPPER
Definition: ddraw.h:721
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
struct _DDRAWI_DIRECTDRAW_INT * LPDDRAWI_DIRECTDRAW_INT
Definition: ddrawi.h:124
HRESULT WINAPI DirectDrawClipper_IsClipListChanged(LPDIRECTDRAWCLIPPER, BOOL *lpbChanged)
Definition: clipper_stubs.c:32
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158