1 /* DirectDrawClipper implementation
3 * Copyright 2000 Marcus Meissner
4 * Copyright 2000 TransGaming Technologies Inc.
12 #include "debugtools.h"
13 #include "ddraw_private.h"
14 #include "dclipper/main.h"
15 #include "ddraw/main.h"
17 DEFAULT_DEBUG_CHANNEL(ddraw);
19 /******************************************************************************
20 * DirectDrawCreateClipper (DDRAW.@)
23 static ICOM_VTABLE(IDirectDrawClipper) DDRAW_Clipper_VTable;
25 HRESULT WINAPI DirectDrawCreateClipper(
26 DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, LPUNKNOWN pUnkOuter
28 IDirectDrawClipperImpl* This;
29 TRACE("(%08lx,%p,%p)\n", dwFlags, lplpDDClipper, pUnkOuter);
31 if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION;
33 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
34 sizeof(IDirectDrawClipperImpl));
35 if (This == NULL) return E_OUTOFMEMORY;
37 ICOM_INIT_INTERFACE(This, IDirectDrawClipper, DDRAW_Clipper_VTable);
40 This->ddraw_owner = NULL;
42 *lplpDDClipper = ICOM_INTERFACE(This, IDirectDrawClipper);
46 /* This is the classfactory implementation. */
47 HRESULT DDRAW_CreateDirectDrawClipper(IUnknown* pUnkOuter, REFIID riid,
51 LPDIRECTDRAWCLIPPER pClip;
53 hr = DirectDrawCreateClipper(0, &pClip, pUnkOuter);
54 if (FAILED(hr)) return hr;
56 hr = IDirectDrawClipper_QueryInterface(pClip, riid, ppObj);
57 IDirectDrawClipper_Release(pClip);
61 /******************************************************************************
64 HRESULT WINAPI Main_DirectDrawClipper_SetHwnd(
65 LPDIRECTDRAWCLIPPER iface, DWORD dwFlags, HWND hWnd
67 ICOM_THIS(IDirectDrawClipperImpl,iface);
69 TRACE("(%p)->SetHwnd(0x%08lx,0x%08lx)\n",This,dwFlags,(DWORD)hWnd);
71 FIXME("dwFlags = 0x%08lx, not supported.\n",dwFlags);
72 return DDERR_INVALIDPARAMS;
79 static void Main_DirectDrawClipper_Destroy(IDirectDrawClipperImpl* This)
81 if (This->ddraw_owner != NULL)
82 Main_DirectDraw_RemoveClipper(This->ddraw_owner, This);
84 HeapFree(GetProcessHeap(), 0 ,This);
87 void Main_DirectDrawClipper_ForceDestroy(IDirectDrawClipperImpl* This)
89 WARN("deleting clipper %p with refcnt %lu\n", This, This->ref);
90 Main_DirectDrawClipper_Destroy(This);
93 ULONG WINAPI Main_DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) {
94 ICOM_THIS(IDirectDrawClipperImpl,iface);
95 TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
99 Main_DirectDrawClipper_Destroy(This);
102 else return This->ref;
105 HRESULT WINAPI Main_DirectDrawClipper_GetClipList(
106 LPDIRECTDRAWCLIPPER iface,LPRECT prcClip,LPRGNDATA lprgn,LPDWORD pdwSize
108 ICOM_THIS(IDirectDrawClipperImpl,iface);
109 FIXME("(%p,%p,%p,%p),stub!\n",This,prcClip,lprgn,pdwSize);
111 if (pdwSize) *pdwSize=0;
115 HRESULT WINAPI Main_DirectDrawClipper_SetClipList(
116 LPDIRECTDRAWCLIPPER iface,LPRGNDATA lprgn,DWORD pdwSize
118 ICOM_THIS(IDirectDrawClipperImpl,iface);
119 FIXME("(%p,%p,%ld),stub!\n",This,lprgn,pdwSize);
124 HRESULT WINAPI Main_DirectDrawClipper_QueryInterface(
125 LPDIRECTDRAWCLIPPER iface, REFIID riid, LPVOID* ppvObj
127 ICOM_THIS(IDirectDrawClipperImpl,iface);
129 if (IsEqualGUID(&IID_IUnknown, riid)
130 || IsEqualGUID(&IID_IDirectDrawClipper, riid))
132 *ppvObj = ICOM_INTERFACE(This, IDirectDrawClipper);
138 return E_NOINTERFACE;
142 ULONG WINAPI Main_DirectDrawClipper_AddRef( LPDIRECTDRAWCLIPPER iface )
144 ICOM_THIS(IDirectDrawClipperImpl,iface);
145 TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
149 HRESULT WINAPI Main_DirectDrawClipper_GetHWnd(
150 LPDIRECTDRAWCLIPPER iface, HWND* hWndPtr
152 ICOM_THIS(IDirectDrawClipperImpl,iface);
153 FIXME("(%p)->(%p),stub!\n",This,hWndPtr);
155 *hWndPtr = This->hWnd;
160 HRESULT WINAPI Main_DirectDrawClipper_Initialize(
161 LPDIRECTDRAWCLIPPER iface, LPDIRECTDRAW lpDD, DWORD dwFlags
163 IDirectDrawImpl* pOwner;
164 ICOM_THIS(IDirectDrawClipperImpl,iface);
165 FIXME("(%p)->(%p,0x%08lx),stub!\n",This,lpDD,dwFlags);
167 if (This->ddraw_owner != NULL) return DDERR_ALREADYINITIALIZED;
169 pOwner = ICOM_OBJECT(IDirectDrawImpl, IDirectDraw, lpDD);
170 This->ddraw_owner = pOwner;
171 Main_DirectDraw_AddClipper(pOwner, This);
176 HRESULT WINAPI Main_DirectDrawClipper_IsClipListChanged(
177 LPDIRECTDRAWCLIPPER iface, BOOL* lpbChanged
179 ICOM_THIS(IDirectDrawClipperImpl,iface);
180 FIXME("(%p)->(%p),stub!\n",This,lpbChanged);
182 /* XXX What is safest? */
188 static ICOM_VTABLE(IDirectDrawClipper) DDRAW_Clipper_VTable =
190 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
191 Main_DirectDrawClipper_QueryInterface,
192 Main_DirectDrawClipper_AddRef,
193 Main_DirectDrawClipper_Release,
194 Main_DirectDrawClipper_GetClipList,
195 Main_DirectDrawClipper_GetHWnd,
196 Main_DirectDrawClipper_Initialize,
197 Main_DirectDrawClipper_IsClipListChanged,
198 Main_DirectDrawClipper_SetClipList,
199 Main_DirectDrawClipper_SetHwnd