1 /* IDirectDrawSurface3 -> IDirectDrawSurface7 thunks
2 * Copyright 2000 TransGaming Technologies Inc.
9 #include "dsurface/main.h"
10 #include "dsurface/thunks.h"
11 #include "ddcomimpl.h"
13 #define CONVERT(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
14 IDirectDrawSurface3, \
15 IDirectDrawSurface7, \
18 #define CONVERT_REV(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
19 IDirectDrawSurface7, \
20 IDirectDrawSurface3, \
24 IDirectDrawSurface3Impl_QueryInterface(LPDIRECTDRAWSURFACE3 This, REFIID iid,
27 return IDirectDrawSurface7_QueryInterface(CONVERT(This), iid, ppObj);
31 IDirectDrawSurface3Impl_AddRef(LPDIRECTDRAWSURFACE3 This)
33 return IDirectDrawSurface7_AddRef(CONVERT(This));
37 IDirectDrawSurface3Impl_Release(LPDIRECTDRAWSURFACE3 This)
39 return IDirectDrawSurface7_Release(CONVERT(This));
43 IDirectDrawSurface3Impl_AddAttachedSurface(LPDIRECTDRAWSURFACE3 This,
44 LPDIRECTDRAWSURFACE3 pAttach)
46 return IDirectDrawSurface7_AddAttachedSurface(CONVERT(This),
51 IDirectDrawSurface3Impl_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE3 This,
54 return IDirectDrawSurface7_AddOverlayDirtyRect(CONVERT(This), pRect);
58 IDirectDrawSurface3Impl_Blt(LPDIRECTDRAWSURFACE3 This, LPRECT prcDst,
59 LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
60 DWORD dwFlags, LPDDBLTFX pFX)
62 return IDirectDrawSurface7_Blt(CONVERT(This), prcDst, CONVERT(pSrcSurf),
63 prcSrc, dwFlags, pFX);
67 IDirectDrawSurface3Impl_BltBatch(LPDIRECTDRAWSURFACE3 This,
68 LPDDBLTBATCH pBatch, DWORD dwCount,
71 return IDirectDrawSurface7_BltBatch(CONVERT(This), pBatch, dwCount,
76 IDirectDrawSurface3Impl_BltFast(LPDIRECTDRAWSURFACE3 This, DWORD x, DWORD y,
77 LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
80 return IDirectDrawSurface7_BltFast(CONVERT(This), x, y, CONVERT(pSrcSurf),
85 IDirectDrawSurface3Impl_DeleteAttachedSurface(LPDIRECTDRAWSURFACE3 This,
87 LPDIRECTDRAWSURFACE3 pAttached)
89 return IDirectDrawSurface7_DeleteAttachedSurface(CONVERT(This), dwFlags,
95 LPDDENUMSURFACESCALLBACK callback;
99 static HRESULT CALLBACK
100 EnumCallback(LPDIRECTDRAWSURFACE7 iface, LPDDSURFACEDESC2 pDDSD,
103 const struct callback_info* info = context;
106 /* This is an outgoing conversion so we have to do it. */
108 memset(&ddsd, 0, sizeof(ddsd));
109 ddsd.dwSize = sizeof(ddsd);
110 DDRAW_Convert_DDSURFACEDESC_2_To_1(pDDSD, &ddsd);
113 /* the LPDDSURFACEDESC2 -> LPDDSURFACEDESC coercion is safe, since
114 * the data format is compatible with older enum procs */
115 return info->callback((LPDIRECTDRAWSURFACE)CONVERT_REV(iface), (LPDDSURFACEDESC)pDDSD,
119 static HRESULT WINAPI
120 IDirectDrawSurface3Impl_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE3 This,
122 LPDDENUMSURFACESCALLBACK callback)
124 struct callback_info info = { callback, context };
125 return IDirectDrawSurface7_EnumAttachedSurfaces(CONVERT(This), &info,
129 static HRESULT WINAPI
130 IDirectDrawSurface3Impl_EnumOverlayZOrders(LPDIRECTDRAWSURFACE3 This,
131 DWORD dwFlags, LPVOID context,
132 LPDDENUMSURFACESCALLBACK callback)
134 struct callback_info info = { callback, context };
135 return IDirectDrawSurface7_EnumOverlayZOrders(CONVERT(This), dwFlags,
136 &info, EnumCallback);
139 static HRESULT WINAPI
140 IDirectDrawSurface3Impl_Flip(LPDIRECTDRAWSURFACE3 This,
141 LPDIRECTDRAWSURFACE3 pOverride, DWORD dwFlags)
143 return IDirectDrawSurface7_Flip(CONVERT(This), CONVERT(pOverride),
147 static HRESULT WINAPI
148 IDirectDrawSurface3Impl_GetAttachedSurface(LPDIRECTDRAWSURFACE3 This,
150 LPDIRECTDRAWSURFACE3* ppAttached)
152 DDSCAPS2 caps = { pCaps->dwCaps, 0, 0, 0 };
153 LPDIRECTDRAWSURFACE7 pAttached7;
156 hr = IDirectDrawSurface7_GetAttachedSurface(CONVERT(This), &caps,
158 if (FAILED(hr)) return hr;
160 *ppAttached = CONVERT_REV(pAttached7);
164 static HRESULT WINAPI
165 IDirectDrawSurface3Impl_GetBltStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
167 return IDirectDrawSurface7_GetBltStatus(CONVERT(This), dwFlags);
170 static HRESULT WINAPI
171 IDirectDrawSurface3Impl_GetCaps(LPDIRECTDRAWSURFACE3 This, LPDDSCAPS pCaps)
176 hr = IDirectDrawSurface7_GetCaps(CONVERT(This), &caps);
177 if (FAILED(hr)) return hr;
179 pCaps->dwCaps = caps.dwCaps;
183 static HRESULT WINAPI
184 IDirectDrawSurface3Impl_GetClipper(LPDIRECTDRAWSURFACE3 This,
185 LPDIRECTDRAWCLIPPER* ppClipper)
187 return IDirectDrawSurface7_GetClipper(CONVERT(This), ppClipper);
190 static HRESULT WINAPI
191 IDirectDrawSurface3Impl_GetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
194 return IDirectDrawSurface7_GetColorKey(CONVERT(This), dwFlags, pCKey);
197 static HRESULT WINAPI
198 IDirectDrawSurface3Impl_GetDC(LPDIRECTDRAWSURFACE3 This, HDC* phDC)
200 return IDirectDrawSurface7_GetDC(CONVERT(This), phDC);
203 static HRESULT WINAPI
204 IDirectDrawSurface3Impl_GetFlipStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
206 return IDirectDrawSurface7_GetFlipStatus(CONVERT(This), dwFlags);
209 static HRESULT WINAPI
210 IDirectDrawSurface3Impl_GetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LPLONG pX,
213 return IDirectDrawSurface7_GetOverlayPosition(CONVERT(This), pX, pY);
216 static HRESULT WINAPI
217 IDirectDrawSurface3Impl_GetPalette(LPDIRECTDRAWSURFACE3 This,
218 LPDIRECTDRAWPALETTE* ppPalette)
220 return IDirectDrawSurface7_GetPalette(CONVERT(This), ppPalette);
223 static HRESULT WINAPI
224 IDirectDrawSurface3Impl_GetPixelFormat(LPDIRECTDRAWSURFACE3 This,
225 LPDDPIXELFORMAT pPixelFormat)
227 return IDirectDrawSurface7_GetPixelFormat(CONVERT(This), pPixelFormat);
230 static HRESULT WINAPI
231 IDirectDrawSurface3Impl_GetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
232 LPDDSURFACEDESC pDDSD)
234 return IDirectDrawSurface7_GetSurfaceDesc(CONVERT(This),
235 (LPDDSURFACEDESC2)pDDSD);
238 static HRESULT WINAPI
239 IDirectDrawSurface3Impl_Initialize(LPDIRECTDRAWSURFACE3 This, LPDIRECTDRAW pDD,
240 LPDDSURFACEDESC pDDSD)
242 return IDirectDrawSurface7_Initialize(CONVERT(This), pDD,
243 (LPDDSURFACEDESC2)pDDSD);
246 static HRESULT WINAPI
247 IDirectDrawSurface3Impl_IsLost(LPDIRECTDRAWSURFACE3 This)
249 return IDirectDrawSurface7_IsLost(CONVERT(This));
252 static HRESULT WINAPI
253 IDirectDrawSurface3Impl_Lock(LPDIRECTDRAWSURFACE3 This, LPRECT pRect,
254 LPDDSURFACEDESC pDDSD, DWORD dwFlags, HANDLE h)
256 return IDirectDrawSurface7_Lock(CONVERT(This), pRect,
257 (LPDDSURFACEDESC2)pDDSD, dwFlags, h);
260 static HRESULT WINAPI
261 IDirectDrawSurface3Impl_ReleaseDC(LPDIRECTDRAWSURFACE3 This, HDC hDC)
263 return IDirectDrawSurface7_ReleaseDC(CONVERT(This), hDC);
266 static HRESULT WINAPI
267 IDirectDrawSurface3Impl_Restore(LPDIRECTDRAWSURFACE3 This)
269 return IDirectDrawSurface7_Restore(CONVERT(This));
272 static HRESULT WINAPI
273 IDirectDrawSurface3Impl_SetClipper(LPDIRECTDRAWSURFACE3 This,
274 LPDIRECTDRAWCLIPPER pClipper)
276 return IDirectDrawSurface7_SetClipper(CONVERT(This), pClipper);
279 static HRESULT WINAPI
280 IDirectDrawSurface3Impl_SetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
283 return IDirectDrawSurface7_SetColorKey(CONVERT(This), dwFlags, pCKey);
286 static HRESULT WINAPI
287 IDirectDrawSurface3Impl_SetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LONG x,
290 return IDirectDrawSurface7_SetOverlayPosition(CONVERT(This), x, y);
293 static HRESULT WINAPI
294 IDirectDrawSurface3Impl_SetPalette(LPDIRECTDRAWSURFACE3 This,
295 LPDIRECTDRAWPALETTE pPalette)
297 return IDirectDrawSurface7_SetPalette(CONVERT(This), pPalette);
300 static HRESULT WINAPI
301 IDirectDrawSurface3Impl_Unlock(LPDIRECTDRAWSURFACE3 This, LPVOID data)
303 /* XXX This might be wrong as LPVOID changed to LPRECT along the way. */
304 return IDirectDrawSurface7_Unlock(CONVERT(This), data);
307 static HRESULT WINAPI
308 IDirectDrawSurface3Impl_UpdateOverlay(LPDIRECTDRAWSURFACE3 This, LPRECT prcSrc,
309 LPDIRECTDRAWSURFACE3 pDstSurf,
310 LPRECT prcDst, DWORD dwFlags,
313 return IDirectDrawSurface7_UpdateOverlay(CONVERT(This), prcSrc,
314 CONVERT(pDstSurf), prcDst,
318 static HRESULT WINAPI
319 IDirectDrawSurface3Impl_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE3 This,
322 return IDirectDrawSurface7_UpdateOverlayDisplay(CONVERT(This), dwFlags);
325 static HRESULT WINAPI
326 IDirectDrawSurface3Impl_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE3 This,
328 LPDIRECTDRAWSURFACE3 pSurfReference)
330 return IDirectDrawSurface7_UpdateOverlayZOrder(CONVERT(This), dwFlags,
331 CONVERT(pSurfReference));
334 static HRESULT WINAPI
335 IDirectDrawSurface3Impl_GetDDInterface(LPDIRECTDRAWSURFACE3 This, LPVOID* ppDD)
337 return IDirectDrawSurface7_GetDDInterface(CONVERT(This), ppDD);
340 static HRESULT WINAPI
341 IDirectDrawSurface3Impl_PageLock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
343 return IDirectDrawSurface7_PageLock(CONVERT(This), dwFlags);
346 static HRESULT WINAPI
347 IDirectDrawSurface3Impl_PageUnlock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
349 return IDirectDrawSurface7_PageUnlock(CONVERT(This), dwFlags);
352 static HRESULT WINAPI
353 IDirectDrawSurface3Impl_SetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
354 LPDDSURFACEDESC pDDSD, DWORD dwFlags)
356 return IDirectDrawSurface7_SetSurfaceDesc(CONVERT(This),
357 (LPDDSURFACEDESC2)pDDSD,
361 ICOM_VTABLE(IDirectDrawSurface3) DDRAW_IDDS3_Thunk_VTable =
363 IDirectDrawSurface3Impl_QueryInterface,
364 IDirectDrawSurface3Impl_AddRef,
365 IDirectDrawSurface3Impl_Release,
366 IDirectDrawSurface3Impl_AddAttachedSurface,
367 IDirectDrawSurface3Impl_AddOverlayDirtyRect,
368 IDirectDrawSurface3Impl_Blt,
369 IDirectDrawSurface3Impl_BltBatch,
370 IDirectDrawSurface3Impl_BltFast,
371 IDirectDrawSurface3Impl_DeleteAttachedSurface,
372 IDirectDrawSurface3Impl_EnumAttachedSurfaces,
373 IDirectDrawSurface3Impl_EnumOverlayZOrders,
374 IDirectDrawSurface3Impl_Flip,
375 IDirectDrawSurface3Impl_GetAttachedSurface,
376 IDirectDrawSurface3Impl_GetBltStatus,
377 IDirectDrawSurface3Impl_GetCaps,
378 IDirectDrawSurface3Impl_GetClipper,
379 IDirectDrawSurface3Impl_GetColorKey,
380 IDirectDrawSurface3Impl_GetDC,
381 IDirectDrawSurface3Impl_GetFlipStatus,
382 IDirectDrawSurface3Impl_GetOverlayPosition,
383 IDirectDrawSurface3Impl_GetPalette,
384 IDirectDrawSurface3Impl_GetPixelFormat,
385 IDirectDrawSurface3Impl_GetSurfaceDesc,
386 IDirectDrawSurface3Impl_Initialize,
387 IDirectDrawSurface3Impl_IsLost,
388 IDirectDrawSurface3Impl_Lock,
389 IDirectDrawSurface3Impl_ReleaseDC,
390 IDirectDrawSurface3Impl_Restore,
391 IDirectDrawSurface3Impl_SetClipper,
392 IDirectDrawSurface3Impl_SetColorKey,
393 IDirectDrawSurface3Impl_SetOverlayPosition,
394 IDirectDrawSurface3Impl_SetPalette,
395 IDirectDrawSurface3Impl_Unlock,
396 IDirectDrawSurface3Impl_UpdateOverlay,
397 IDirectDrawSurface3Impl_UpdateOverlayDisplay,
398 IDirectDrawSurface3Impl_UpdateOverlayZOrder,
399 IDirectDrawSurface3Impl_GetDDInterface,
400 IDirectDrawSurface3Impl_PageLock,
401 IDirectDrawSurface3Impl_PageUnlock,
402 IDirectDrawSurface3Impl_SetSurfaceDesc