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
28 #include "dsurface/main.h"
29 #include "dsurface/thunks.h"
30 #include "ddcomimpl.h"
32 #define CONVERT(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
33 IDirectDrawSurface3, \
34 IDirectDrawSurface7, \
37 #define CONVERT_REV(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
38 IDirectDrawSurface7, \
39 IDirectDrawSurface3, \
43 IDirectDrawSurface3Impl_QueryInterface(LPDIRECTDRAWSURFACE3 This, REFIID iid,
46 return IDirectDrawSurface7_QueryInterface(CONVERT(This), iid, ppObj);
50 IDirectDrawSurface3Impl_AddRef(LPDIRECTDRAWSURFACE3 This)
52 return IDirectDrawSurface7_AddRef(CONVERT(This));
56 IDirectDrawSurface3Impl_Release(LPDIRECTDRAWSURFACE3 This)
58 return IDirectDrawSurface7_Release(CONVERT(This));
62 IDirectDrawSurface3Impl_AddAttachedSurface(LPDIRECTDRAWSURFACE3 This,
63 LPDIRECTDRAWSURFACE3 pAttach)
65 return IDirectDrawSurface7_AddAttachedSurface(CONVERT(This),
70 IDirectDrawSurface3Impl_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE3 This,
73 return IDirectDrawSurface7_AddOverlayDirtyRect(CONVERT(This), pRect);
77 IDirectDrawSurface3Impl_Blt(LPDIRECTDRAWSURFACE3 This, LPRECT prcDst,
78 LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
79 DWORD dwFlags, LPDDBLTFX pFX)
81 return IDirectDrawSurface7_Blt(CONVERT(This), prcDst, CONVERT(pSrcSurf),
82 prcSrc, dwFlags, pFX);
86 IDirectDrawSurface3Impl_BltBatch(LPDIRECTDRAWSURFACE3 This,
87 LPDDBLTBATCH pBatch, DWORD dwCount,
90 return IDirectDrawSurface7_BltBatch(CONVERT(This), pBatch, dwCount,
95 IDirectDrawSurface3Impl_BltFast(LPDIRECTDRAWSURFACE3 This, DWORD x, DWORD y,
96 LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
99 return IDirectDrawSurface7_BltFast(CONVERT(This), x, y, CONVERT(pSrcSurf),
103 static HRESULT WINAPI
104 IDirectDrawSurface3Impl_DeleteAttachedSurface(LPDIRECTDRAWSURFACE3 This,
106 LPDIRECTDRAWSURFACE3 pAttached)
108 return IDirectDrawSurface7_DeleteAttachedSurface(CONVERT(This), dwFlags,
114 LPDDENUMSURFACESCALLBACK callback;
118 static HRESULT CALLBACK
119 EnumCallback(LPDIRECTDRAWSURFACE7 iface, LPDDSURFACEDESC2 pDDSD,
122 const struct callback_info* info = context;
125 /* This is an outgoing conversion so we have to do it. */
127 memset(&ddsd, 0, sizeof(ddsd));
128 ddsd.dwSize = sizeof(ddsd);
129 DDRAW_Convert_DDSURFACEDESC_2_To_1(pDDSD, &ddsd);
132 /* the LPDDSURFACEDESC2 -> LPDDSURFACEDESC coercion is safe, since
133 * the data format is compatible with older enum procs */
134 return info->callback((LPDIRECTDRAWSURFACE)CONVERT_REV(iface), (LPDDSURFACEDESC)pDDSD,
138 static HRESULT WINAPI
139 IDirectDrawSurface3Impl_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE3 This,
141 LPDDENUMSURFACESCALLBACK callback)
143 struct callback_info info;
145 info.callback = callback;
146 info.context = context;
148 return IDirectDrawSurface7_EnumAttachedSurfaces(CONVERT(This), &info,
152 static HRESULT WINAPI
153 IDirectDrawSurface3Impl_EnumOverlayZOrders(LPDIRECTDRAWSURFACE3 This,
154 DWORD dwFlags, LPVOID context,
155 LPDDENUMSURFACESCALLBACK callback)
157 struct callback_info info;
159 info.callback = callback;
160 info.context = context;
162 return IDirectDrawSurface7_EnumOverlayZOrders(CONVERT(This), dwFlags,
163 &info, EnumCallback);
166 static HRESULT WINAPI
167 IDirectDrawSurface3Impl_Flip(LPDIRECTDRAWSURFACE3 This,
168 LPDIRECTDRAWSURFACE3 pOverride, DWORD dwFlags)
170 return IDirectDrawSurface7_Flip(CONVERT(This), CONVERT(pOverride),
174 static HRESULT WINAPI
175 IDirectDrawSurface3Impl_GetAttachedSurface(LPDIRECTDRAWSURFACE3 This,
177 LPDIRECTDRAWSURFACE3* ppAttached)
180 LPDIRECTDRAWSURFACE7 pAttached7;
183 caps.dwCaps = pCaps->dwCaps;
188 hr = IDirectDrawSurface7_GetAttachedSurface(CONVERT(This), &caps,
190 if (FAILED(hr)) return hr;
192 *ppAttached = CONVERT_REV(pAttached7);
196 static HRESULT WINAPI
197 IDirectDrawSurface3Impl_GetBltStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
199 return IDirectDrawSurface7_GetBltStatus(CONVERT(This), dwFlags);
202 static HRESULT WINAPI
203 IDirectDrawSurface3Impl_GetCaps(LPDIRECTDRAWSURFACE3 This, LPDDSCAPS pCaps)
208 hr = IDirectDrawSurface7_GetCaps(CONVERT(This), &caps);
209 if (FAILED(hr)) return hr;
211 pCaps->dwCaps = caps.dwCaps;
215 static HRESULT WINAPI
216 IDirectDrawSurface3Impl_GetClipper(LPDIRECTDRAWSURFACE3 This,
217 LPDIRECTDRAWCLIPPER* ppClipper)
219 return IDirectDrawSurface7_GetClipper(CONVERT(This), ppClipper);
222 static HRESULT WINAPI
223 IDirectDrawSurface3Impl_GetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
226 return IDirectDrawSurface7_GetColorKey(CONVERT(This), dwFlags, pCKey);
229 static HRESULT WINAPI
230 IDirectDrawSurface3Impl_GetDC(LPDIRECTDRAWSURFACE3 This, HDC* phDC)
232 return IDirectDrawSurface7_GetDC(CONVERT(This), phDC);
235 static HRESULT WINAPI
236 IDirectDrawSurface3Impl_GetFlipStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
238 return IDirectDrawSurface7_GetFlipStatus(CONVERT(This), dwFlags);
241 static HRESULT WINAPI
242 IDirectDrawSurface3Impl_GetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LPLONG pX,
245 return IDirectDrawSurface7_GetOverlayPosition(CONVERT(This), pX, pY);
248 static HRESULT WINAPI
249 IDirectDrawSurface3Impl_GetPalette(LPDIRECTDRAWSURFACE3 This,
250 LPDIRECTDRAWPALETTE* ppPalette)
252 return IDirectDrawSurface7_GetPalette(CONVERT(This), ppPalette);
255 static HRESULT WINAPI
256 IDirectDrawSurface3Impl_GetPixelFormat(LPDIRECTDRAWSURFACE3 This,
257 LPDDPIXELFORMAT pPixelFormat)
259 return IDirectDrawSurface7_GetPixelFormat(CONVERT(This), pPixelFormat);
262 static HRESULT WINAPI
263 IDirectDrawSurface3Impl_GetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
264 LPDDSURFACEDESC pDDSD)
266 return IDirectDrawSurface7_GetSurfaceDesc(CONVERT(This),
267 (LPDDSURFACEDESC2)pDDSD);
270 static HRESULT WINAPI
271 IDirectDrawSurface3Impl_Initialize(LPDIRECTDRAWSURFACE3 This, LPDIRECTDRAW pDD,
272 LPDDSURFACEDESC pDDSD)
274 return IDirectDrawSurface7_Initialize(CONVERT(This), pDD,
275 (LPDDSURFACEDESC2)pDDSD);
278 static HRESULT WINAPI
279 IDirectDrawSurface3Impl_IsLost(LPDIRECTDRAWSURFACE3 This)
281 return IDirectDrawSurface7_IsLost(CONVERT(This));
284 static HRESULT WINAPI
285 IDirectDrawSurface3Impl_Lock(LPDIRECTDRAWSURFACE3 This, LPRECT pRect,
286 LPDDSURFACEDESC pDDSD, DWORD dwFlags, HANDLE h)
288 return IDirectDrawSurface7_Lock(CONVERT(This), pRect,
289 (LPDDSURFACEDESC2)pDDSD, dwFlags, h);
292 static HRESULT WINAPI
293 IDirectDrawSurface3Impl_ReleaseDC(LPDIRECTDRAWSURFACE3 This, HDC hDC)
295 return IDirectDrawSurface7_ReleaseDC(CONVERT(This), hDC);
298 static HRESULT WINAPI
299 IDirectDrawSurface3Impl_Restore(LPDIRECTDRAWSURFACE3 This)
301 return IDirectDrawSurface7_Restore(CONVERT(This));
304 static HRESULT WINAPI
305 IDirectDrawSurface3Impl_SetClipper(LPDIRECTDRAWSURFACE3 This,
306 LPDIRECTDRAWCLIPPER pClipper)
308 return IDirectDrawSurface7_SetClipper(CONVERT(This), pClipper);
311 static HRESULT WINAPI
312 IDirectDrawSurface3Impl_SetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
315 return IDirectDrawSurface7_SetColorKey(CONVERT(This), dwFlags, pCKey);
318 static HRESULT WINAPI
319 IDirectDrawSurface3Impl_SetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LONG x,
322 return IDirectDrawSurface7_SetOverlayPosition(CONVERT(This), x, y);
325 static HRESULT WINAPI
326 IDirectDrawSurface3Impl_SetPalette(LPDIRECTDRAWSURFACE3 This,
327 LPDIRECTDRAWPALETTE pPalette)
329 return IDirectDrawSurface7_SetPalette(CONVERT(This), pPalette);
332 static HRESULT WINAPI
333 IDirectDrawSurface3Impl_Unlock(LPDIRECTDRAWSURFACE3 This, LPVOID data)
335 /* data might not be the LPRECT of later versions, so drop it. */
336 return IDirectDrawSurface7_Unlock(CONVERT(This), NULL);
339 static HRESULT WINAPI
340 IDirectDrawSurface3Impl_UpdateOverlay(LPDIRECTDRAWSURFACE3 This, LPRECT prcSrc,
341 LPDIRECTDRAWSURFACE3 pDstSurf,
342 LPRECT prcDst, DWORD dwFlags,
345 return IDirectDrawSurface7_UpdateOverlay(CONVERT(This), prcSrc,
346 CONVERT(pDstSurf), prcDst,
350 static HRESULT WINAPI
351 IDirectDrawSurface3Impl_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE3 This,
354 return IDirectDrawSurface7_UpdateOverlayDisplay(CONVERT(This), dwFlags);
357 static HRESULT WINAPI
358 IDirectDrawSurface3Impl_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE3 This,
360 LPDIRECTDRAWSURFACE3 pSurfReference)
362 return IDirectDrawSurface7_UpdateOverlayZOrder(CONVERT(This), dwFlags,
363 CONVERT(pSurfReference));
366 static HRESULT WINAPI
367 IDirectDrawSurface3Impl_GetDDInterface(LPDIRECTDRAWSURFACE3 This, LPVOID* ppDD)
369 return IDirectDrawSurface7_GetDDInterface(CONVERT(This), ppDD);
372 static HRESULT WINAPI
373 IDirectDrawSurface3Impl_PageLock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
375 return IDirectDrawSurface7_PageLock(CONVERT(This), dwFlags);
378 static HRESULT WINAPI
379 IDirectDrawSurface3Impl_PageUnlock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
381 return IDirectDrawSurface7_PageUnlock(CONVERT(This), dwFlags);
384 static HRESULT WINAPI
385 IDirectDrawSurface3Impl_SetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
386 LPDDSURFACEDESC pDDSD, DWORD dwFlags)
388 return IDirectDrawSurface7_SetSurfaceDesc(CONVERT(This),
389 (LPDDSURFACEDESC2)pDDSD,
393 IDirectDrawSurface3Vtbl DDRAW_IDDS3_Thunk_VTable =
395 IDirectDrawSurface3Impl_QueryInterface,
396 IDirectDrawSurface3Impl_AddRef,
397 IDirectDrawSurface3Impl_Release,
398 IDirectDrawSurface3Impl_AddAttachedSurface,
399 IDirectDrawSurface3Impl_AddOverlayDirtyRect,
400 IDirectDrawSurface3Impl_Blt,
401 IDirectDrawSurface3Impl_BltBatch,
402 IDirectDrawSurface3Impl_BltFast,
403 IDirectDrawSurface3Impl_DeleteAttachedSurface,
404 IDirectDrawSurface3Impl_EnumAttachedSurfaces,
405 IDirectDrawSurface3Impl_EnumOverlayZOrders,
406 IDirectDrawSurface3Impl_Flip,
407 IDirectDrawSurface3Impl_GetAttachedSurface,
408 IDirectDrawSurface3Impl_GetBltStatus,
409 IDirectDrawSurface3Impl_GetCaps,
410 IDirectDrawSurface3Impl_GetClipper,
411 IDirectDrawSurface3Impl_GetColorKey,
412 IDirectDrawSurface3Impl_GetDC,
413 IDirectDrawSurface3Impl_GetFlipStatus,
414 IDirectDrawSurface3Impl_GetOverlayPosition,
415 IDirectDrawSurface3Impl_GetPalette,
416 IDirectDrawSurface3Impl_GetPixelFormat,
417 IDirectDrawSurface3Impl_GetSurfaceDesc,
418 IDirectDrawSurface3Impl_Initialize,
419 IDirectDrawSurface3Impl_IsLost,
420 IDirectDrawSurface3Impl_Lock,
421 IDirectDrawSurface3Impl_ReleaseDC,
422 IDirectDrawSurface3Impl_Restore,
423 IDirectDrawSurface3Impl_SetClipper,
424 IDirectDrawSurface3Impl_SetColorKey,
425 IDirectDrawSurface3Impl_SetOverlayPosition,
426 IDirectDrawSurface3Impl_SetPalette,
427 IDirectDrawSurface3Impl_Unlock,
428 IDirectDrawSurface3Impl_UpdateOverlay,
429 IDirectDrawSurface3Impl_UpdateOverlayDisplay,
430 IDirectDrawSurface3Impl_UpdateOverlayZOrder,
431 IDirectDrawSurface3Impl_GetDDInterface,
432 IDirectDrawSurface3Impl_PageLock,
433 IDirectDrawSurface3Impl_PageUnlock,
434 IDirectDrawSurface3Impl_SetSurfaceDesc