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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/port.h"
21 #include "wine/debug.h"
30 #include "ddraw_private.h"
31 #include "ddcomimpl.h"
33 #define CONVERT(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
34 IDirectDrawSurface3, \
35 IDirectDrawSurface7, \
38 #define CONVERT_REV(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
39 IDirectDrawSurface7, \
40 IDirectDrawSurface3, \
43 WINE_DEFAULT_DEBUG_CHANNEL(ddraw_thunk
);
46 IDirectDrawSurface3Impl_QueryInterface(LPDIRECTDRAWSURFACE3 This
, REFIID iid
,
49 return IDirectDrawSurface7_QueryInterface(CONVERT(This
), iid
, ppObj
);
53 IDirectDrawSurface3Impl_AddRef(LPDIRECTDRAWSURFACE3 This
)
55 return IDirectDrawSurface7_AddRef(CONVERT(This
));
59 IDirectDrawSurface3Impl_Release(LPDIRECTDRAWSURFACE3 iface
)
61 ICOM_THIS_FROM( IDirectDrawSurfaceImpl
, IDirectDrawSurface3
, iface
);
62 TRACE("(%p)\n", This
);
63 return IDirectDrawSurface7_Release(CONVERT(iface
));
67 IDirectDrawSurface3Impl_AddAttachedSurface(LPDIRECTDRAWSURFACE3 This
,
68 LPDIRECTDRAWSURFACE3 pAttach
)
70 return IDirectDrawSurface7_AddAttachedSurface(CONVERT(This
),
75 IDirectDrawSurface3Impl_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE3 This
,
78 return IDirectDrawSurface7_AddOverlayDirtyRect(CONVERT(This
), pRect
);
82 IDirectDrawSurface3Impl_Blt(LPDIRECTDRAWSURFACE3 This
, LPRECT prcDst
,
83 LPDIRECTDRAWSURFACE3 pSrcSurf
, LPRECT prcSrc
,
84 DWORD dwFlags
, LPDDBLTFX pFX
)
86 return IDirectDrawSurface7_Blt(CONVERT(This
), prcDst
, CONVERT(pSrcSurf
),
87 prcSrc
, dwFlags
, pFX
);
91 IDirectDrawSurface3Impl_BltBatch(LPDIRECTDRAWSURFACE3 This
,
92 LPDDBLTBATCH pBatch
, DWORD dwCount
,
95 return IDirectDrawSurface7_BltBatch(CONVERT(This
), pBatch
, dwCount
,
100 IDirectDrawSurface3Impl_BltFast(LPDIRECTDRAWSURFACE3 This
, DWORD x
, DWORD y
,
101 LPDIRECTDRAWSURFACE3 pSrcSurf
, LPRECT prcSrc
,
104 return IDirectDrawSurface7_BltFast(CONVERT(This
), x
, y
, CONVERT(pSrcSurf
),
108 static HRESULT WINAPI
109 IDirectDrawSurface3Impl_DeleteAttachedSurface(LPDIRECTDRAWSURFACE3 This
,
111 LPDIRECTDRAWSURFACE3 pAttached
)
113 return IDirectDrawSurface7_DeleteAttachedSurface(CONVERT(This
), dwFlags
,
119 LPDDENUMSURFACESCALLBACK callback
;
123 static HRESULT CALLBACK
124 EnumCallback(LPDIRECTDRAWSURFACE7 iface
, LPDDSURFACEDESC2 pDDSD
,
127 const struct callback_info
* info
= context
;
130 /* This is an outgoing conversion so we have to do it. */
132 memset(&ddsd
, 0, sizeof(ddsd
));
133 ddsd
.dwSize
= sizeof(ddsd
);
134 DDRAW_Convert_DDSURFACEDESC_2_To_1(pDDSD
, &ddsd
);
137 /* the LPDDSURFACEDESC2 -> LPDDSURFACEDESC coercion is safe, since
138 * the data format is compatible with older enum procs */
139 return info
->callback((LPDIRECTDRAWSURFACE
)CONVERT_REV(iface
), (LPDDSURFACEDESC
)pDDSD
,
143 static HRESULT WINAPI
144 IDirectDrawSurface3Impl_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE3 This
,
146 LPDDENUMSURFACESCALLBACK callback
)
148 struct callback_info info
;
150 info
.callback
= callback
;
151 info
.context
= context
;
153 return IDirectDrawSurface7_EnumAttachedSurfaces(CONVERT(This
), &info
,
157 static HRESULT WINAPI
158 IDirectDrawSurface3Impl_EnumOverlayZOrders(LPDIRECTDRAWSURFACE3 This
,
159 DWORD dwFlags
, LPVOID context
,
160 LPDDENUMSURFACESCALLBACK callback
)
162 struct callback_info info
;
164 info
.callback
= callback
;
165 info
.context
= context
;
167 return IDirectDrawSurface7_EnumOverlayZOrders(CONVERT(This
), dwFlags
,
168 &info
, EnumCallback
);
171 static HRESULT WINAPI
172 IDirectDrawSurface3Impl_Flip(LPDIRECTDRAWSURFACE3 This
,
173 LPDIRECTDRAWSURFACE3 pOverride
, DWORD dwFlags
)
175 return IDirectDrawSurface7_Flip(CONVERT(This
), CONVERT(pOverride
),
179 static HRESULT WINAPI
180 IDirectDrawSurface3Impl_GetAttachedSurface(LPDIRECTDRAWSURFACE3 This
,
182 LPDIRECTDRAWSURFACE3
* ppAttached
)
185 LPDIRECTDRAWSURFACE7 pAttached7
;
188 caps
.dwCaps
= pCaps
->dwCaps
;
193 hr
= IDirectDrawSurface7_GetAttachedSurface(CONVERT(This
), &caps
,
195 if (FAILED(hr
)) return hr
;
197 *ppAttached
= CONVERT_REV(pAttached7
);
201 static HRESULT WINAPI
202 IDirectDrawSurface3Impl_GetBltStatus(LPDIRECTDRAWSURFACE3 This
, DWORD dwFlags
)
204 return IDirectDrawSurface7_GetBltStatus(CONVERT(This
), dwFlags
);
207 static HRESULT WINAPI
208 IDirectDrawSurface3Impl_GetCaps(LPDIRECTDRAWSURFACE3 This
, LPDDSCAPS pCaps
)
213 hr
= IDirectDrawSurface7_GetCaps(CONVERT(This
), &caps
);
214 if (FAILED(hr
)) return hr
;
216 pCaps
->dwCaps
= caps
.dwCaps
;
220 static HRESULT WINAPI
221 IDirectDrawSurface3Impl_GetClipper(LPDIRECTDRAWSURFACE3 This
,
222 LPDIRECTDRAWCLIPPER
* ppClipper
)
224 return IDirectDrawSurface7_GetClipper(CONVERT(This
), ppClipper
);
227 static HRESULT WINAPI
228 IDirectDrawSurface3Impl_GetColorKey(LPDIRECTDRAWSURFACE3 This
, DWORD dwFlags
,
231 return IDirectDrawSurface7_GetColorKey(CONVERT(This
), dwFlags
, pCKey
);
234 static HRESULT WINAPI
235 IDirectDrawSurface3Impl_GetDC(LPDIRECTDRAWSURFACE3 This
, HDC
* phDC
)
237 return IDirectDrawSurface7_GetDC(CONVERT(This
), phDC
);
240 static HRESULT WINAPI
241 IDirectDrawSurface3Impl_GetFlipStatus(LPDIRECTDRAWSURFACE3 This
, DWORD dwFlags
)
243 return IDirectDrawSurface7_GetFlipStatus(CONVERT(This
), dwFlags
);
246 static HRESULT WINAPI
247 IDirectDrawSurface3Impl_GetOverlayPosition(LPDIRECTDRAWSURFACE3 This
, LPLONG pX
,
250 return IDirectDrawSurface7_GetOverlayPosition(CONVERT(This
), pX
, pY
);
253 static HRESULT WINAPI
254 IDirectDrawSurface3Impl_GetPalette(LPDIRECTDRAWSURFACE3 This
,
255 LPDIRECTDRAWPALETTE
* ppPalette
)
257 return IDirectDrawSurface7_GetPalette(CONVERT(This
), ppPalette
);
260 static HRESULT WINAPI
261 IDirectDrawSurface3Impl_GetPixelFormat(LPDIRECTDRAWSURFACE3 This
,
262 LPDDPIXELFORMAT pPixelFormat
)
264 return IDirectDrawSurface7_GetPixelFormat(CONVERT(This
), pPixelFormat
);
267 static HRESULT WINAPI
268 IDirectDrawSurface3Impl_GetSurfaceDesc(LPDIRECTDRAWSURFACE3 This
,
269 LPDDSURFACEDESC pDDSD
)
271 return IDirectDrawSurface7_GetSurfaceDesc(CONVERT(This
),
272 (LPDDSURFACEDESC2
)pDDSD
);
275 static HRESULT WINAPI
276 IDirectDrawSurface3Impl_Initialize(LPDIRECTDRAWSURFACE3 This
, LPDIRECTDRAW pDD
,
277 LPDDSURFACEDESC pDDSD
)
279 return IDirectDrawSurface7_Initialize(CONVERT(This
), pDD
,
280 (LPDDSURFACEDESC2
)pDDSD
);
283 static HRESULT WINAPI
284 IDirectDrawSurface3Impl_IsLost(LPDIRECTDRAWSURFACE3 This
)
286 return IDirectDrawSurface7_IsLost(CONVERT(This
));
289 static HRESULT WINAPI
290 IDirectDrawSurface3Impl_Lock(LPDIRECTDRAWSURFACE3 This
, LPRECT pRect
,
291 LPDDSURFACEDESC pDDSD
, DWORD dwFlags
, HANDLE h
)
293 return IDirectDrawSurface7_Lock(CONVERT(This
), pRect
,
294 (LPDDSURFACEDESC2
)pDDSD
, dwFlags
, h
);
297 static HRESULT WINAPI
298 IDirectDrawSurface3Impl_ReleaseDC(LPDIRECTDRAWSURFACE3 This
, HDC hDC
)
300 return IDirectDrawSurface7_ReleaseDC(CONVERT(This
), hDC
);
303 static HRESULT WINAPI
304 IDirectDrawSurface3Impl_Restore(LPDIRECTDRAWSURFACE3 This
)
306 return IDirectDrawSurface7_Restore(CONVERT(This
));
309 static HRESULT WINAPI
310 IDirectDrawSurface3Impl_SetClipper(LPDIRECTDRAWSURFACE3 This
,
311 LPDIRECTDRAWCLIPPER pClipper
)
313 return IDirectDrawSurface7_SetClipper(CONVERT(This
), pClipper
);
316 static HRESULT WINAPI
317 IDirectDrawSurface3Impl_SetColorKey(LPDIRECTDRAWSURFACE3 This
, DWORD dwFlags
,
320 return IDirectDrawSurface7_SetColorKey(CONVERT(This
), dwFlags
, pCKey
);
323 static HRESULT WINAPI
324 IDirectDrawSurface3Impl_SetOverlayPosition(LPDIRECTDRAWSURFACE3 This
, LONG x
,
327 return IDirectDrawSurface7_SetOverlayPosition(CONVERT(This
), x
, y
);
330 static HRESULT WINAPI
331 IDirectDrawSurface3Impl_SetPalette(LPDIRECTDRAWSURFACE3 This
,
332 LPDIRECTDRAWPALETTE pPalette
)
334 return IDirectDrawSurface7_SetPalette(CONVERT(This
), pPalette
);
337 static HRESULT WINAPI
338 IDirectDrawSurface3Impl_Unlock(LPDIRECTDRAWSURFACE3 This
, LPVOID data
)
340 /* data might not be the LPRECT of later versions, so drop it. */
341 return IDirectDrawSurface7_Unlock(CONVERT(This
), NULL
);
344 static HRESULT WINAPI
345 IDirectDrawSurface3Impl_UpdateOverlay(LPDIRECTDRAWSURFACE3 This
, LPRECT prcSrc
,
346 LPDIRECTDRAWSURFACE3 pDstSurf
,
347 LPRECT prcDst
, DWORD dwFlags
,
350 return IDirectDrawSurface7_UpdateOverlay(CONVERT(This
), prcSrc
,
351 CONVERT(pDstSurf
), prcDst
,
355 static HRESULT WINAPI
356 IDirectDrawSurface3Impl_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE3 This
,
359 return IDirectDrawSurface7_UpdateOverlayDisplay(CONVERT(This
), dwFlags
);
362 static HRESULT WINAPI
363 IDirectDrawSurface3Impl_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE3 This
,
365 LPDIRECTDRAWSURFACE3 pSurfReference
)
367 return IDirectDrawSurface7_UpdateOverlayZOrder(CONVERT(This
), dwFlags
,
368 CONVERT(pSurfReference
));
371 static HRESULT WINAPI
372 IDirectDrawSurface3Impl_GetDDInterface(LPDIRECTDRAWSURFACE3 This
, LPVOID
* ppDD
)
374 return IDirectDrawSurface7_GetDDInterface(CONVERT(This
), ppDD
);
377 static HRESULT WINAPI
378 IDirectDrawSurface3Impl_PageLock(LPDIRECTDRAWSURFACE3 This
, DWORD dwFlags
)
380 return IDirectDrawSurface7_PageLock(CONVERT(This
), dwFlags
);
383 static HRESULT WINAPI
384 IDirectDrawSurface3Impl_PageUnlock(LPDIRECTDRAWSURFACE3 This
, DWORD dwFlags
)
386 return IDirectDrawSurface7_PageUnlock(CONVERT(This
), dwFlags
);
389 static HRESULT WINAPI
390 IDirectDrawSurface3Impl_SetSurfaceDesc(LPDIRECTDRAWSURFACE3 This
,
391 LPDDSURFACEDESC pDDSD
, DWORD dwFlags
)
393 return IDirectDrawSurface7_SetSurfaceDesc(CONVERT(This
),
394 (LPDDSURFACEDESC2
)pDDSD
,
398 const IDirectDrawSurface3Vtbl IDirectDrawSurface3_Vtbl
=
400 IDirectDrawSurface3Impl_QueryInterface
,
401 IDirectDrawSurface3Impl_AddRef
,
402 IDirectDrawSurface3Impl_Release
,
403 IDirectDrawSurface3Impl_AddAttachedSurface
,
404 IDirectDrawSurface3Impl_AddOverlayDirtyRect
,
405 IDirectDrawSurface3Impl_Blt
,
406 IDirectDrawSurface3Impl_BltBatch
,
407 IDirectDrawSurface3Impl_BltFast
,
408 IDirectDrawSurface3Impl_DeleteAttachedSurface
,
409 IDirectDrawSurface3Impl_EnumAttachedSurfaces
,
410 IDirectDrawSurface3Impl_EnumOverlayZOrders
,
411 IDirectDrawSurface3Impl_Flip
,
412 IDirectDrawSurface3Impl_GetAttachedSurface
,
413 IDirectDrawSurface3Impl_GetBltStatus
,
414 IDirectDrawSurface3Impl_GetCaps
,
415 IDirectDrawSurface3Impl_GetClipper
,
416 IDirectDrawSurface3Impl_GetColorKey
,
417 IDirectDrawSurface3Impl_GetDC
,
418 IDirectDrawSurface3Impl_GetFlipStatus
,
419 IDirectDrawSurface3Impl_GetOverlayPosition
,
420 IDirectDrawSurface3Impl_GetPalette
,
421 IDirectDrawSurface3Impl_GetPixelFormat
,
422 IDirectDrawSurface3Impl_GetSurfaceDesc
,
423 IDirectDrawSurface3Impl_Initialize
,
424 IDirectDrawSurface3Impl_IsLost
,
425 IDirectDrawSurface3Impl_Lock
,
426 IDirectDrawSurface3Impl_ReleaseDC
,
427 IDirectDrawSurface3Impl_Restore
,
428 IDirectDrawSurface3Impl_SetClipper
,
429 IDirectDrawSurface3Impl_SetColorKey
,
430 IDirectDrawSurface3Impl_SetOverlayPosition
,
431 IDirectDrawSurface3Impl_SetPalette
,
432 IDirectDrawSurface3Impl_Unlock
,
433 IDirectDrawSurface3Impl_UpdateOverlay
,
434 IDirectDrawSurface3Impl_UpdateOverlayDisplay
,
435 IDirectDrawSurface3Impl_UpdateOverlayZOrder
,
436 IDirectDrawSurface3Impl_GetDDInterface
,
437 IDirectDrawSurface3Impl_PageLock
,
438 IDirectDrawSurface3Impl_PageUnlock
,
439 IDirectDrawSurface3Impl_SetSurfaceDesc