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 "ddraw_private.h"
29 #include "ddcomimpl.h"
31 #define CONVERT(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
32 IDirectDrawSurface3, \
33 IDirectDrawSurface7, \
36 #define CONVERT_REV(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
37 IDirectDrawSurface7, \
38 IDirectDrawSurface3, \
42 IDirectDrawSurface3Impl_QueryInterface(LPDIRECTDRAWSURFACE3 This, REFIID iid,
45 return IDirectDrawSurface7_QueryInterface(CONVERT(This), iid, ppObj);
49 IDirectDrawSurface3Impl_AddRef(LPDIRECTDRAWSURFACE3 This)
51 return IDirectDrawSurface7_AddRef(CONVERT(This));
55 IDirectDrawSurface3Impl_Release(LPDIRECTDRAWSURFACE3 This)
57 return IDirectDrawSurface7_Release(CONVERT(This));
61 IDirectDrawSurface3Impl_AddAttachedSurface(LPDIRECTDRAWSURFACE3 This,
62 LPDIRECTDRAWSURFACE3 pAttach)
64 return IDirectDrawSurface7_AddAttachedSurface(CONVERT(This),
69 IDirectDrawSurface3Impl_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE3 This,
72 return IDirectDrawSurface7_AddOverlayDirtyRect(CONVERT(This), pRect);
76 IDirectDrawSurface3Impl_Blt(LPDIRECTDRAWSURFACE3 This, LPRECT prcDst,
77 LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
78 DWORD dwFlags, LPDDBLTFX pFX)
80 return IDirectDrawSurface7_Blt(CONVERT(This), prcDst, CONVERT(pSrcSurf),
81 prcSrc, dwFlags, pFX);
85 IDirectDrawSurface3Impl_BltBatch(LPDIRECTDRAWSURFACE3 This,
86 LPDDBLTBATCH pBatch, DWORD dwCount,
89 return IDirectDrawSurface7_BltBatch(CONVERT(This), pBatch, dwCount,
94 IDirectDrawSurface3Impl_BltFast(LPDIRECTDRAWSURFACE3 This, DWORD x, DWORD y,
95 LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
98 return IDirectDrawSurface7_BltFast(CONVERT(This), x, y, CONVERT(pSrcSurf),
102 static HRESULT WINAPI
103 IDirectDrawSurface3Impl_DeleteAttachedSurface(LPDIRECTDRAWSURFACE3 This,
105 LPDIRECTDRAWSURFACE3 pAttached)
107 return IDirectDrawSurface7_DeleteAttachedSurface(CONVERT(This), dwFlags,
113 LPDDENUMSURFACESCALLBACK callback;
117 static HRESULT CALLBACK
118 EnumCallback(LPDIRECTDRAWSURFACE7 iface, LPDDSURFACEDESC2 pDDSD,
121 const struct callback_info* info = context;
124 /* This is an outgoing conversion so we have to do it. */
126 memset(&ddsd, 0, sizeof(ddsd));
127 ddsd.dwSize = sizeof(ddsd);
128 DDRAW_Convert_DDSURFACEDESC_2_To_1(pDDSD, &ddsd);
131 /* the LPDDSURFACEDESC2 -> LPDDSURFACEDESC coercion is safe, since
132 * the data format is compatible with older enum procs */
133 return info->callback((LPDIRECTDRAWSURFACE)CONVERT_REV(iface), (LPDDSURFACEDESC)pDDSD,
137 static HRESULT WINAPI
138 IDirectDrawSurface3Impl_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE3 This,
140 LPDDENUMSURFACESCALLBACK callback)
142 struct callback_info info;
144 info.callback = callback;
145 info.context = context;
147 return IDirectDrawSurface7_EnumAttachedSurfaces(CONVERT(This), &info,
151 static HRESULT WINAPI
152 IDirectDrawSurface3Impl_EnumOverlayZOrders(LPDIRECTDRAWSURFACE3 This,
153 DWORD dwFlags, LPVOID context,
154 LPDDENUMSURFACESCALLBACK callback)
156 struct callback_info info;
158 info.callback = callback;
159 info.context = context;
161 return IDirectDrawSurface7_EnumOverlayZOrders(CONVERT(This), dwFlags,
162 &info, EnumCallback);
165 static HRESULT WINAPI
166 IDirectDrawSurface3Impl_Flip(LPDIRECTDRAWSURFACE3 This,
167 LPDIRECTDRAWSURFACE3 pOverride, DWORD dwFlags)
169 return IDirectDrawSurface7_Flip(CONVERT(This), CONVERT(pOverride),
173 static HRESULT WINAPI
174 IDirectDrawSurface3Impl_GetAttachedSurface(LPDIRECTDRAWSURFACE3 This,
176 LPDIRECTDRAWSURFACE3* ppAttached)
179 LPDIRECTDRAWSURFACE7 pAttached7;
182 caps.dwCaps = pCaps->dwCaps;
187 hr = IDirectDrawSurface7_GetAttachedSurface(CONVERT(This), &caps,
189 if (FAILED(hr)) return hr;
191 *ppAttached = CONVERT_REV(pAttached7);
195 static HRESULT WINAPI
196 IDirectDrawSurface3Impl_GetBltStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
198 return IDirectDrawSurface7_GetBltStatus(CONVERT(This), dwFlags);
201 static HRESULT WINAPI
202 IDirectDrawSurface3Impl_GetCaps(LPDIRECTDRAWSURFACE3 This, LPDDSCAPS pCaps)
207 hr = IDirectDrawSurface7_GetCaps(CONVERT(This), &caps);
208 if (FAILED(hr)) return hr;
210 pCaps->dwCaps = caps.dwCaps;
214 static HRESULT WINAPI
215 IDirectDrawSurface3Impl_GetClipper(LPDIRECTDRAWSURFACE3 This,
216 LPDIRECTDRAWCLIPPER* ppClipper)
218 return IDirectDrawSurface7_GetClipper(CONVERT(This), ppClipper);
221 static HRESULT WINAPI
222 IDirectDrawSurface3Impl_GetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
225 return IDirectDrawSurface7_GetColorKey(CONVERT(This), dwFlags, pCKey);
228 static HRESULT WINAPI
229 IDirectDrawSurface3Impl_GetDC(LPDIRECTDRAWSURFACE3 This, HDC* phDC)
231 return IDirectDrawSurface7_GetDC(CONVERT(This), phDC);
234 static HRESULT WINAPI
235 IDirectDrawSurface3Impl_GetFlipStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
237 return IDirectDrawSurface7_GetFlipStatus(CONVERT(This), dwFlags);
240 static HRESULT WINAPI
241 IDirectDrawSurface3Impl_GetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LPLONG pX,
244 return IDirectDrawSurface7_GetOverlayPosition(CONVERT(This), pX, pY);
247 static HRESULT WINAPI
248 IDirectDrawSurface3Impl_GetPalette(LPDIRECTDRAWSURFACE3 This,
249 LPDIRECTDRAWPALETTE* ppPalette)
251 return IDirectDrawSurface7_GetPalette(CONVERT(This), ppPalette);
254 static HRESULT WINAPI
255 IDirectDrawSurface3Impl_GetPixelFormat(LPDIRECTDRAWSURFACE3 This,
256 LPDDPIXELFORMAT pPixelFormat)
258 return IDirectDrawSurface7_GetPixelFormat(CONVERT(This), pPixelFormat);
261 static HRESULT WINAPI
262 IDirectDrawSurface3Impl_GetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
263 LPDDSURFACEDESC pDDSD)
265 return IDirectDrawSurface7_GetSurfaceDesc(CONVERT(This),
266 (LPDDSURFACEDESC2)pDDSD);
269 static HRESULT WINAPI
270 IDirectDrawSurface3Impl_Initialize(LPDIRECTDRAWSURFACE3 This, LPDIRECTDRAW pDD,
271 LPDDSURFACEDESC pDDSD)
273 return IDirectDrawSurface7_Initialize(CONVERT(This), pDD,
274 (LPDDSURFACEDESC2)pDDSD);
277 static HRESULT WINAPI
278 IDirectDrawSurface3Impl_IsLost(LPDIRECTDRAWSURFACE3 This)
280 return IDirectDrawSurface7_IsLost(CONVERT(This));
283 static HRESULT WINAPI
284 IDirectDrawSurface3Impl_Lock(LPDIRECTDRAWSURFACE3 This, LPRECT pRect,
285 LPDDSURFACEDESC pDDSD, DWORD dwFlags, HANDLE h)
287 return IDirectDrawSurface7_Lock(CONVERT(This), pRect,
288 (LPDDSURFACEDESC2)pDDSD, dwFlags, h);
291 static HRESULT WINAPI
292 IDirectDrawSurface3Impl_ReleaseDC(LPDIRECTDRAWSURFACE3 This, HDC hDC)
294 return IDirectDrawSurface7_ReleaseDC(CONVERT(This), hDC);
297 static HRESULT WINAPI
298 IDirectDrawSurface3Impl_Restore(LPDIRECTDRAWSURFACE3 This)
300 return IDirectDrawSurface7_Restore(CONVERT(This));
303 static HRESULT WINAPI
304 IDirectDrawSurface3Impl_SetClipper(LPDIRECTDRAWSURFACE3 This,
305 LPDIRECTDRAWCLIPPER pClipper)
307 return IDirectDrawSurface7_SetClipper(CONVERT(This), pClipper);
310 static HRESULT WINAPI
311 IDirectDrawSurface3Impl_SetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
314 return IDirectDrawSurface7_SetColorKey(CONVERT(This), dwFlags, pCKey);
317 static HRESULT WINAPI
318 IDirectDrawSurface3Impl_SetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LONG x,
321 return IDirectDrawSurface7_SetOverlayPosition(CONVERT(This), x, y);
324 static HRESULT WINAPI
325 IDirectDrawSurface3Impl_SetPalette(LPDIRECTDRAWSURFACE3 This,
326 LPDIRECTDRAWPALETTE pPalette)
328 return IDirectDrawSurface7_SetPalette(CONVERT(This), pPalette);
331 static HRESULT WINAPI
332 IDirectDrawSurface3Impl_Unlock(LPDIRECTDRAWSURFACE3 This, LPVOID data)
334 /* data might not be the LPRECT of later versions, so drop it. */
335 return IDirectDrawSurface7_Unlock(CONVERT(This), NULL);
338 static HRESULT WINAPI
339 IDirectDrawSurface3Impl_UpdateOverlay(LPDIRECTDRAWSURFACE3 This, LPRECT prcSrc,
340 LPDIRECTDRAWSURFACE3 pDstSurf,
341 LPRECT prcDst, DWORD dwFlags,
344 return IDirectDrawSurface7_UpdateOverlay(CONVERT(This), prcSrc,
345 CONVERT(pDstSurf), prcDst,
349 static HRESULT WINAPI
350 IDirectDrawSurface3Impl_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE3 This,
353 return IDirectDrawSurface7_UpdateOverlayDisplay(CONVERT(This), dwFlags);
356 static HRESULT WINAPI
357 IDirectDrawSurface3Impl_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE3 This,
359 LPDIRECTDRAWSURFACE3 pSurfReference)
361 return IDirectDrawSurface7_UpdateOverlayZOrder(CONVERT(This), dwFlags,
362 CONVERT(pSurfReference));
365 static HRESULT WINAPI
366 IDirectDrawSurface3Impl_GetDDInterface(LPDIRECTDRAWSURFACE3 This, LPVOID* ppDD)
368 return IDirectDrawSurface7_GetDDInterface(CONVERT(This), ppDD);
371 static HRESULT WINAPI
372 IDirectDrawSurface3Impl_PageLock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
374 return IDirectDrawSurface7_PageLock(CONVERT(This), dwFlags);
377 static HRESULT WINAPI
378 IDirectDrawSurface3Impl_PageUnlock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
380 return IDirectDrawSurface7_PageUnlock(CONVERT(This), dwFlags);
383 static HRESULT WINAPI
384 IDirectDrawSurface3Impl_SetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
385 LPDDSURFACEDESC pDDSD, DWORD dwFlags)
387 return IDirectDrawSurface7_SetSurfaceDesc(CONVERT(This),
388 (LPDDSURFACEDESC2)pDDSD,
392 const IDirectDrawSurface3Vtbl DDRAW_IDDS3_Thunk_VTable =
394 IDirectDrawSurface3Impl_QueryInterface,
395 IDirectDrawSurface3Impl_AddRef,
396 IDirectDrawSurface3Impl_Release,
397 IDirectDrawSurface3Impl_AddAttachedSurface,
398 IDirectDrawSurface3Impl_AddOverlayDirtyRect,
399 IDirectDrawSurface3Impl_Blt,
400 IDirectDrawSurface3Impl_BltBatch,
401 IDirectDrawSurface3Impl_BltFast,
402 IDirectDrawSurface3Impl_DeleteAttachedSurface,
403 IDirectDrawSurface3Impl_EnumAttachedSurfaces,
404 IDirectDrawSurface3Impl_EnumOverlayZOrders,
405 IDirectDrawSurface3Impl_Flip,
406 IDirectDrawSurface3Impl_GetAttachedSurface,
407 IDirectDrawSurface3Impl_GetBltStatus,
408 IDirectDrawSurface3Impl_GetCaps,
409 IDirectDrawSurface3Impl_GetClipper,
410 IDirectDrawSurface3Impl_GetColorKey,
411 IDirectDrawSurface3Impl_GetDC,
412 IDirectDrawSurface3Impl_GetFlipStatus,
413 IDirectDrawSurface3Impl_GetOverlayPosition,
414 IDirectDrawSurface3Impl_GetPalette,
415 IDirectDrawSurface3Impl_GetPixelFormat,
416 IDirectDrawSurface3Impl_GetSurfaceDesc,
417 IDirectDrawSurface3Impl_Initialize,
418 IDirectDrawSurface3Impl_IsLost,
419 IDirectDrawSurface3Impl_Lock,
420 IDirectDrawSurface3Impl_ReleaseDC,
421 IDirectDrawSurface3Impl_Restore,
422 IDirectDrawSurface3Impl_SetClipper,
423 IDirectDrawSurface3Impl_SetColorKey,
424 IDirectDrawSurface3Impl_SetOverlayPosition,
425 IDirectDrawSurface3Impl_SetPalette,
426 IDirectDrawSurface3Impl_Unlock,
427 IDirectDrawSurface3Impl_UpdateOverlay,
428 IDirectDrawSurface3Impl_UpdateOverlayDisplay,
429 IDirectDrawSurface3Impl_UpdateOverlayZOrder,
430 IDirectDrawSurface3Impl_GetDDInterface,
431 IDirectDrawSurface3Impl_PageLock,
432 IDirectDrawSurface3Impl_PageUnlock,
433 IDirectDrawSurface3Impl_SetSurfaceDesc