1 /* DirectDrawClipper implementation
3 * Copyright 2000 Marcus Meissner
4 * Copyright 2000 TransGaming Technologies Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "ddraw_private.h"
30 #include "dclipper/main.h"
31 #include "ddraw/main.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
37 /******************************************************************************
38 * DirectDrawCreateClipper (DDRAW.@)
41 static ICOM_VTABLE(IDirectDrawClipper) DDRAW_Clipper_VTable;
43 HRESULT WINAPI DirectDrawCreateClipper(
44 DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, LPUNKNOWN pUnkOuter
46 IDirectDrawClipperImpl* This;
47 TRACE("(%08lx,%p,%p)\n", dwFlags, lplpDDClipper, pUnkOuter);
49 if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION;
51 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
52 sizeof(IDirectDrawClipperImpl));
53 if (This == NULL) return E_OUTOFMEMORY;
55 ICOM_INIT_INTERFACE(This, IDirectDrawClipper, DDRAW_Clipper_VTable);
58 This->ddraw_owner = NULL;
60 *lplpDDClipper = ICOM_INTERFACE(This, IDirectDrawClipper);
64 /* This is the classfactory implementation. */
65 HRESULT DDRAW_CreateDirectDrawClipper(IUnknown* pUnkOuter, REFIID riid,
69 LPDIRECTDRAWCLIPPER pClip;
71 hr = DirectDrawCreateClipper(0, &pClip, pUnkOuter);
72 if (FAILED(hr)) return hr;
74 hr = IDirectDrawClipper_QueryInterface(pClip, riid, ppObj);
75 IDirectDrawClipper_Release(pClip);
79 /******************************************************************************
82 HRESULT WINAPI Main_DirectDrawClipper_SetHwnd(
83 LPDIRECTDRAWCLIPPER iface, DWORD dwFlags, HWND hWnd
85 ICOM_THIS(IDirectDrawClipperImpl,iface);
87 TRACE("(%p)->SetHwnd(0x%08lx,0x%08lx)\n",This,dwFlags,(DWORD)hWnd);
89 FIXME("dwFlags = 0x%08lx, not supported.\n",dwFlags);
90 return DDERR_INVALIDPARAMS;
97 static void Main_DirectDrawClipper_Destroy(IDirectDrawClipperImpl* This)
99 if (This->ddraw_owner != NULL)
100 Main_DirectDraw_RemoveClipper(This->ddraw_owner, This);
102 HeapFree(GetProcessHeap(), 0 ,This);
105 void Main_DirectDrawClipper_ForceDestroy(IDirectDrawClipperImpl* This)
107 WARN("deleting clipper %p with refcnt %lu\n", This, This->ref);
108 Main_DirectDrawClipper_Destroy(This);
111 ULONG WINAPI Main_DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) {
112 ICOM_THIS(IDirectDrawClipperImpl,iface);
113 TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
115 if (--This->ref == 0)
117 Main_DirectDrawClipper_Destroy(This);
120 else return This->ref;
123 HRESULT WINAPI Main_DirectDrawClipper_GetClipList(
124 LPDIRECTDRAWCLIPPER iface,LPRECT prcClip,LPRGNDATA lprgn,LPDWORD pdwSize
126 ICOM_THIS(IDirectDrawClipperImpl,iface);
127 static int warned = 0;
129 FIXME("(%p,%p,%p,%p),stub!\n",This,prcClip,lprgn,pdwSize);
130 if (pdwSize) *pdwSize=0;
131 return DDERR_NOCLIPLIST;
134 HRESULT WINAPI Main_DirectDrawClipper_SetClipList(
135 LPDIRECTDRAWCLIPPER iface,LPRGNDATA lprgn,DWORD pdwSize
137 ICOM_THIS(IDirectDrawClipperImpl,iface);
138 FIXME("(%p,%p,%ld),stub!\n",This,lprgn,pdwSize);
142 HRESULT WINAPI Main_DirectDrawClipper_QueryInterface(
143 LPDIRECTDRAWCLIPPER iface, REFIID riid, LPVOID* ppvObj
145 ICOM_THIS(IDirectDrawClipperImpl,iface);
147 if (IsEqualGUID(&IID_IUnknown, riid)
148 || IsEqualGUID(&IID_IDirectDrawClipper, riid))
150 *ppvObj = ICOM_INTERFACE(This, IDirectDrawClipper);
156 return E_NOINTERFACE;
160 ULONG WINAPI Main_DirectDrawClipper_AddRef( LPDIRECTDRAWCLIPPER iface )
162 ICOM_THIS(IDirectDrawClipperImpl,iface);
163 TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
167 HRESULT WINAPI Main_DirectDrawClipper_GetHWnd(
168 LPDIRECTDRAWCLIPPER iface, HWND* hWndPtr
170 ICOM_THIS(IDirectDrawClipperImpl,iface);
171 FIXME("(%p)->(%p),stub!\n",This,hWndPtr);
173 *hWndPtr = This->hWnd;
178 HRESULT WINAPI Main_DirectDrawClipper_Initialize(
179 LPDIRECTDRAWCLIPPER iface, LPDIRECTDRAW lpDD, DWORD dwFlags
181 IDirectDrawImpl* pOwner;
182 ICOM_THIS(IDirectDrawClipperImpl,iface);
183 FIXME("(%p)->(%p,0x%08lx),stub!\n",This,lpDD,dwFlags);
185 if (This->ddraw_owner != NULL) return DDERR_ALREADYINITIALIZED;
187 pOwner = ICOM_OBJECT(IDirectDrawImpl, IDirectDraw, lpDD);
188 This->ddraw_owner = pOwner;
189 Main_DirectDraw_AddClipper(pOwner, This);
194 HRESULT WINAPI Main_DirectDrawClipper_IsClipListChanged(
195 LPDIRECTDRAWCLIPPER iface, BOOL* lpbChanged
197 ICOM_THIS(IDirectDrawClipperImpl,iface);
198 FIXME("(%p)->(%p),stub!\n",This,lpbChanged);
200 /* XXX What is safest? */
206 static ICOM_VTABLE(IDirectDrawClipper) DDRAW_Clipper_VTable =
208 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
209 Main_DirectDrawClipper_QueryInterface,
210 Main_DirectDrawClipper_AddRef,
211 Main_DirectDrawClipper_Release,
212 Main_DirectDrawClipper_GetClipList,
213 Main_DirectDrawClipper_GetHWnd,
214 Main_DirectDrawClipper_Initialize,
215 Main_DirectDrawClipper_IsClipListChanged,
216 Main_DirectDrawClipper_SetClipList,
217 Main_DirectDrawClipper_SetHwnd