1 /* IDirectDrawSurface3 -> IDirectDrawSurface7 thunks
2 * Copyright 2000 TransGaming Technologies Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include "dsurface/main.h"
31 #include "dsurface/thunks.h"
32 #include "ddcomimpl.h"
34 #define CONVERT(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
35 IDirectDrawSurface3, \
36 IDirectDrawSurface7, \
39 #define CONVERT_REV(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
40 IDirectDrawSurface7, \
41 IDirectDrawSurface3, \
45 IDirectDrawSurface3Impl_QueryInterface(LPDIRECTDRAWSURFACE3 This, REFIID iid,
48 return IDirectDrawSurface7_QueryInterface(CONVERT(This), iid, ppObj);
52 IDirectDrawSurface3Impl_AddRef(LPDIRECTDRAWSURFACE3 This)
54 return IDirectDrawSurface7_AddRef(CONVERT(This));
58 IDirectDrawSurface3Impl_Release(LPDIRECTDRAWSURFACE3 This)
60 return IDirectDrawSurface7_Release(CONVERT(This));
64 IDirectDrawSurface3Impl_AddAttachedSurface(LPDIRECTDRAWSURFACE3 This,
65 LPDIRECTDRAWSURFACE3 pAttach)
67 return IDirectDrawSurface7_AddAttachedSurface(CONVERT(This),
72 IDirectDrawSurface3Impl_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE3 This,
75 return IDirectDrawSurface7_AddOverlayDirtyRect(CONVERT(This), pRect);
79 IDirectDrawSurface3Impl_Blt(LPDIRECTDRAWSURFACE3 This, LPRECT prcDst,
80 LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
81 DWORD dwFlags, LPDDBLTFX pFX)
83 return IDirectDrawSurface7_Blt(CONVERT(This), prcDst, CONVERT(pSrcSurf),
84 prcSrc, dwFlags, pFX);
88 IDirectDrawSurface3Impl_BltBatch(LPDIRECTDRAWSURFACE3 This,
89 LPDDBLTBATCH pBatch, DWORD dwCount,
92 return IDirectDrawSurface7_BltBatch(CONVERT(This), pBatch, dwCount,
97 IDirectDrawSurface3Impl_BltFast(LPDIRECTDRAWSURFACE3 This, DWORD x, DWORD y,
98 LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
101 return IDirectDrawSurface7_BltFast(CONVERT(This), x, y, CONVERT(pSrcSurf),
105 static HRESULT WINAPI
106 IDirectDrawSurface3Impl_DeleteAttachedSurface(LPDIRECTDRAWSURFACE3 This,
108 LPDIRECTDRAWSURFACE3 pAttached)
110 return IDirectDrawSurface7_DeleteAttachedSurface(CONVERT(This), dwFlags,
116 LPDDENUMSURFACESCALLBACK callback;
120 static HRESULT CALLBACK
121 EnumCallback(LPDIRECTDRAWSURFACE7 iface, LPDDSURFACEDESC2 pDDSD,
124 const struct callback_info* info = context;
127 /* This is an outgoing conversion so we have to do it. */
129 memset(&ddsd, 0, sizeof(ddsd));
130 ddsd.dwSize = sizeof(ddsd);
131 DDRAW_Convert_DDSURFACEDESC_2_To_1(pDDSD, &ddsd);
134 /* the LPDDSURFACEDESC2 -> LPDDSURFACEDESC coercion is safe, since
135 * the data format is compatible with older enum procs */
136 return info->callback((LPDIRECTDRAWSURFACE)CONVERT_REV(iface), (LPDDSURFACEDESC)pDDSD,
140 static HRESULT WINAPI
141 IDirectDrawSurface3Impl_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE3 This,
143 LPDDENUMSURFACESCALLBACK callback)
145 struct callback_info info;
147 info.callback = callback;
148 info.context = context;
150 return IDirectDrawSurface7_EnumAttachedSurfaces(CONVERT(This), &info,
154 static HRESULT WINAPI
155 IDirectDrawSurface3Impl_EnumOverlayZOrders(LPDIRECTDRAWSURFACE3 This,
156 DWORD dwFlags, LPVOID context,
157 LPDDENUMSURFACESCALLBACK callback)
159 struct callback_info info;
161 info.callback = callback;
162 info.context = context;
164 return IDirectDrawSurface7_EnumOverlayZOrders(CONVERT(This), dwFlags,
165 &info, EnumCallback);
168 static HRESULT WINAPI
169 IDirectDrawSurface3Impl_Flip(LPDIRECTDRAWSURFACE3 This,
170 LPDIRECTDRAWSURFACE3 pOverride, DWORD dwFlags)
172 return IDirectDrawSurface7_Flip(CONVERT(This), CONVERT(pOverride),
176 static HRESULT WINAPI
177 IDirectDrawSurface3Impl_GetAttachedSurface(LPDIRECTDRAWSURFACE3 This,
179 LPDIRECTDRAWSURFACE3* ppAttached)
182 LPDIRECTDRAWSURFACE7 pAttached7;
185 caps.dwCaps = pCaps->dwCaps;
190 hr = IDirectDrawSurface7_GetAttachedSurface(CONVERT(This), &caps,
192 if (FAILED(hr)) return hr;
194 *ppAttached = CONVERT_REV(pAttached7);
198 static HRESULT WINAPI
199 IDirectDrawSurface3Impl_GetBltStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
201 return IDirectDrawSurface7_GetBltStatus(CONVERT(This), dwFlags);
204 static HRESULT WINAPI
205 IDirectDrawSurface3Impl_GetCaps(LPDIRECTDRAWSURFACE3 This, LPDDSCAPS pCaps)
210 hr = IDirectDrawSurface7_GetCaps(CONVERT(This), &caps);
211 if (FAILED(hr)) return hr;
213 pCaps->dwCaps = caps.dwCaps;
217 static HRESULT WINAPI
218 IDirectDrawSurface3Impl_GetClipper(LPDIRECTDRAWSURFACE3 This,
219 LPDIRECTDRAWCLIPPER* ppClipper)
221 return IDirectDrawSurface7_GetClipper(CONVERT(This), ppClipper);
224 static HRESULT WINAPI
225 IDirectDrawSurface3Impl_GetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
228 return IDirectDrawSurface7_GetColorKey(CONVERT(This), dwFlags, pCKey);
231 static HRESULT WINAPI
232 IDirectDrawSurface3Impl_GetDC(LPDIRECTDRAWSURFACE3 This, HDC* phDC)
234 return IDirectDrawSurface7_GetDC(CONVERT(This), phDC);
237 static HRESULT WINAPI
238 IDirectDrawSurface3Impl_GetFlipStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
240 return IDirectDrawSurface7_GetFlipStatus(CONVERT(This), dwFlags);
243 static HRESULT WINAPI
244 IDirectDrawSurface3Impl_GetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LPLONG pX,
247 return IDirectDrawSurface7_GetOverlayPosition(CONVERT(This), pX, pY);
250 static HRESULT WINAPI
251 IDirectDrawSurface3Impl_GetPalette(LPDIRECTDRAWSURFACE3 This,
252 LPDIRECTDRAWPALETTE* ppPalette)
254 return IDirectDrawSurface7_GetPalette(CONVERT(This), ppPalette);
257 static HRESULT WINAPI
258 IDirectDrawSurface3Impl_GetPixelFormat(LPDIRECTDRAWSURFACE3 This,
259 LPDDPIXELFORMAT pPixelFormat)
261 return IDirectDrawSurface7_GetPixelFormat(CONVERT(This), pPixelFormat);
264 static HRESULT WINAPI
265 IDirectDrawSurface3Impl_GetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
266 LPDDSURFACEDESC pDDSD)
268 return IDirectDrawSurface7_GetSurfaceDesc(CONVERT(This),
269 (LPDDSURFACEDESC2)pDDSD);
272 static HRESULT WINAPI
273 IDirectDrawSurface3Impl_Initialize(LPDIRECTDRAWSURFACE3 This, LPDIRECTDRAW pDD,
274 LPDDSURFACEDESC pDDSD)
276 return IDirectDrawSurface7_Initialize(CONVERT(This), pDD,
277 (LPDDSURFACEDESC2)pDDSD);
280 static HRESULT WINAPI
281 IDirectDrawSurface3Impl_IsLost(LPDIRECTDRAWSURFACE3 This)
283 return IDirectDrawSurface7_IsLost(CONVERT(This));
286 static HRESULT WINAPI
287 IDirectDrawSurface3Impl_Lock(LPDIRECTDRAWSURFACE3 This, LPRECT pRect,
288 LPDDSURFACEDESC pDDSD, DWORD dwFlags, HANDLE h)
290 return IDirectDrawSurface7_Lock(CONVERT(This), pRect,
291 (LPDDSURFACEDESC2)pDDSD, dwFlags, h);
294 static HRESULT WINAPI
295 IDirectDrawSurface3Impl_ReleaseDC(LPDIRECTDRAWSURFACE3 This, HDC hDC)
297 return IDirectDrawSurface7_ReleaseDC(CONVERT(This), hDC);
300 static HRESULT WINAPI
301 IDirectDrawSurface3Impl_Restore(LPDIRECTDRAWSURFACE3 This)
303 return IDirectDrawSurface7_Restore(CONVERT(This));
306 static HRESULT WINAPI
307 IDirectDrawSurface3Impl_SetClipper(LPDIRECTDRAWSURFACE3 This,
308 LPDIRECTDRAWCLIPPER pClipper)
310 return IDirectDrawSurface7_SetClipper(CONVERT(This), pClipper);
313 static HRESULT WINAPI
314 IDirectDrawSurface3Impl_SetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
317 return IDirectDrawSurface7_SetColorKey(CONVERT(This), dwFlags, pCKey);
320 static HRESULT WINAPI
321 IDirectDrawSurface3Impl_SetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LONG x,
324 return IDirectDrawSurface7_SetOverlayPosition(CONVERT(This), x, y);
327 static HRESULT WINAPI
328 IDirectDrawSurface3Impl_SetPalette(LPDIRECTDRAWSURFACE3 This,
329 LPDIRECTDRAWPALETTE pPalette)
331 return IDirectDrawSurface7_SetPalette(CONVERT(This), pPalette);
334 static HRESULT WINAPI
335 IDirectDrawSurface3Impl_Unlock(LPDIRECTDRAWSURFACE3 This, LPVOID data)
337 /* data might not be the LPRECT of later versions, so drop it. */
338 return IDirectDrawSurface7_Unlock(CONVERT(This), NULL);
341 static HRESULT WINAPI
342 IDirectDrawSurface3Impl_UpdateOverlay(LPDIRECTDRAWSURFACE3 This, LPRECT prcSrc,
343 LPDIRECTDRAWSURFACE3 pDstSurf,
344 LPRECT prcDst, DWORD dwFlags,
347 return IDirectDrawSurface7_UpdateOverlay(CONVERT(This), prcSrc,
348 CONVERT(pDstSurf), prcDst,
352 static HRESULT WINAPI
353 IDirectDrawSurface3Impl_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE3 This,
356 return IDirectDrawSurface7_UpdateOverlayDisplay(CONVERT(This), dwFlags);
359 static HRESULT WINAPI
360 IDirectDrawSurface3Impl_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE3 This,
362 LPDIRECTDRAWSURFACE3 pSurfReference)
364 return IDirectDrawSurface7_UpdateOverlayZOrder(CONVERT(This), dwFlags,
365 CONVERT(pSurfReference));
368 static HRESULT WINAPI
369 IDirectDrawSurface3Impl_GetDDInterface(LPDIRECTDRAWSURFACE3 This, LPVOID* ppDD)
371 return IDirectDrawSurface7_GetDDInterface(CONVERT(This), ppDD);
374 static HRESULT WINAPI
375 IDirectDrawSurface3Impl_PageLock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
377 return IDirectDrawSurface7_PageLock(CONVERT(This), dwFlags);
380 static HRESULT WINAPI
381 IDirectDrawSurface3Impl_PageUnlock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
383 return IDirectDrawSurface7_PageUnlock(CONVERT(This), dwFlags);
386 static HRESULT WINAPI
387 IDirectDrawSurface3Impl_SetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
388 LPDDSURFACEDESC pDDSD, DWORD dwFlags)
390 return IDirectDrawSurface7_SetSurfaceDesc(CONVERT(This),
391 (LPDDSURFACEDESC2)pDDSD,
395 const IDirectDrawSurface3Vtbl DDRAW_IDDS3_Thunk_VTable =
397 IDirectDrawSurface3Impl_QueryInterface,
398 IDirectDrawSurface3Impl_AddRef,
399 IDirectDrawSurface3Impl_Release,
400 IDirectDrawSurface3Impl_AddAttachedSurface,
401 IDirectDrawSurface3Impl_AddOverlayDirtyRect,
402 IDirectDrawSurface3Impl_Blt,
403 IDirectDrawSurface3Impl_BltBatch,
404 IDirectDrawSurface3Impl_BltFast,
405 IDirectDrawSurface3Impl_DeleteAttachedSurface,
406 IDirectDrawSurface3Impl_EnumAttachedSurfaces,
407 IDirectDrawSurface3Impl_EnumOverlayZOrders,
408 IDirectDrawSurface3Impl_Flip,
409 IDirectDrawSurface3Impl_GetAttachedSurface,
410 IDirectDrawSurface3Impl_GetBltStatus,
411 IDirectDrawSurface3Impl_GetCaps,
412 IDirectDrawSurface3Impl_GetClipper,
413 IDirectDrawSurface3Impl_GetColorKey,
414 IDirectDrawSurface3Impl_GetDC,
415 IDirectDrawSurface3Impl_GetFlipStatus,
416 IDirectDrawSurface3Impl_GetOverlayPosition,
417 IDirectDrawSurface3Impl_GetPalette,
418 IDirectDrawSurface3Impl_GetPixelFormat,
419 IDirectDrawSurface3Impl_GetSurfaceDesc,
420 IDirectDrawSurface3Impl_Initialize,
421 IDirectDrawSurface3Impl_IsLost,
422 IDirectDrawSurface3Impl_Lock,
423 IDirectDrawSurface3Impl_ReleaseDC,
424 IDirectDrawSurface3Impl_Restore,
425 IDirectDrawSurface3Impl_SetClipper,
426 IDirectDrawSurface3Impl_SetColorKey,
427 IDirectDrawSurface3Impl_SetOverlayPosition,
428 IDirectDrawSurface3Impl_SetPalette,
429 IDirectDrawSurface3Impl_Unlock,
430 IDirectDrawSurface3Impl_UpdateOverlay,
431 IDirectDrawSurface3Impl_UpdateOverlayDisplay,
432 IDirectDrawSurface3Impl_UpdateOverlayZOrder,
433 IDirectDrawSurface3Impl_GetDDInterface,
434 IDirectDrawSurface3Impl_PageLock,
435 IDirectDrawSurface3Impl_PageUnlock,
436 IDirectDrawSurface3Impl_SetSurfaceDesc