Implemented thunks for IDirectDrawSurface and IDirectDraw. This isn't good code, because it is a mixture of wine and our code. But it works as far as I can see. I will fix it someday.

svn path=/trunk/; revision=18740
This commit is contained in:
Maarten Bosma 2005-10-24 16:29:36 +00:00
parent d235bb6282
commit c40fbd1850
12 changed files with 1666 additions and 37 deletions

View file

@ -1,4 +1,4 @@
<module name="ddraw" type="win32dll" installbase="system32" installname="ddraw.dll" allowwarnings="true"> <module name="ddraw" type="win32dll" installbase="system32" installname="ddraw.dll">
<importlibrary definition="ddraw.def" /> <importlibrary definition="ddraw.def" />
<include base="ddraw">.</include> <include base="ddraw">.</include>
<define name="UNICODE" /> <define name="UNICODE" />
@ -35,4 +35,9 @@
<file>ddraw.c</file> <file>ddraw.c</file>
<file>surface.c</file> <file>surface.c</file>
</directory> </directory>
<directory name="thunks">
<file>ddraw.c</file>
<file>surface.c</file>
</directory>
</module> </module>

View file

@ -13,8 +13,7 @@
#include "rosdraw.h" #include "rosdraw.h"
HRESULT WINAPI Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, HRESULT WINAPI Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, REFIID id, BOOL ex)
IUnknown* pUnkOuter, BOOL ex)
{ {
IDirectDrawImpl* This = (IDirectDrawImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl)); IDirectDrawImpl* This = (IDirectDrawImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl));
@ -23,10 +22,17 @@ HRESULT WINAPI Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
ZeroMemory(This,sizeof(IDirectDrawImpl)); ZeroMemory(This,sizeof(IDirectDrawImpl));
This->lpVtbl = &DirectDraw_Vtable; This->lpVtbl = &DirectDraw7_Vtable;
This->lpVtbl_v1 = &DDRAW_IDirectDraw_VTable;
This->lpVtbl_v2 = &DDRAW_IDirectDraw2_VTable;
This->lpVtbl_v4 = &DDRAW_IDirectDraw4_VTable;
This->DirectDrawGlobal.dwRefCnt = 1; This->DirectDrawGlobal.dwRefCnt = 1;
*pIface = (LPDIRECTDRAW)This; *pIface = (LPDIRECTDRAW)This;
if(This->lpVtbl->QueryInterface ((LPDIRECTDRAW7)This, id, (void**)&pIface) != S_OK)
return DDERR_INVALIDPARAMS;
return This->lpVtbl->Initialize ((LPDIRECTDRAW7)This, pGUID); return This->lpVtbl->Initialize ((LPDIRECTDRAW7)This, pGUID);
} }
@ -39,10 +45,10 @@ HRESULT WINAPI DirectDrawCreate (LPGUID lpGUID, LPDIRECTDRAW* lplpDD, LPUNKNOWN
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
return Create_DirectDraw (lpGUID, lplpDD, pUnkOuter, FALSE); return Create_DirectDraw (lpGUID, lplpDD, &IID_IDirectDraw, FALSE);
} }
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID iid, LPUNKNOWN pUnkOuter) HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
{ {
/* check see if pUnkOuter is null or not */ /* check see if pUnkOuter is null or not */
if (pUnkOuter) if (pUnkOuter)
@ -52,12 +58,12 @@ HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID iid, LPU
} }
/* Is it a DirectDraw 7 Request or not */ /* Is it a DirectDraw 7 Request or not */
if (!IsEqualGUID(iid, &IID_IDirectDraw7)) if (!IsEqualGUID(id, &IID_IDirectDraw7))
{ {
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, pUnkOuter, TRUE); return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, TRUE);
} }
HRESULT WINAPI DirectDrawEnumerateA( HRESULT WINAPI DirectDrawEnumerateA(
@ -65,7 +71,7 @@ HRESULT WINAPI DirectDrawEnumerateA(
LPVOID lpContext LPVOID lpContext
) )
{ {
return DD_OK; DX_STUB;
} }
@ -74,7 +80,7 @@ HRESULT WINAPI DirectDrawEnumerateW(
LPVOID lpContext LPVOID lpContext
) )
{ {
return DD_OK; DX_STUB;
} }
HRESULT WINAPI DirectDrawEnumerateExA( HRESULT WINAPI DirectDrawEnumerateExA(
@ -83,7 +89,7 @@ HRESULT WINAPI DirectDrawEnumerateExA(
DWORD dwFlags DWORD dwFlags
) )
{ {
return DD_OK; DX_STUB;
} }
HRESULT WINAPI DirectDrawEnumerateExW( HRESULT WINAPI DirectDrawEnumerateExW(
@ -92,7 +98,7 @@ HRESULT WINAPI DirectDrawEnumerateExW(
DWORD dwFlags DWORD dwFlags
) )
{ {
return DD_OK; DX_STUB;
} }
HRESULT WINAPI DirectDrawCreateClipper( HRESULT WINAPI DirectDrawCreateClipper(
@ -101,6 +107,5 @@ HRESULT WINAPI DirectDrawCreateClipper(
LPUNKNOWN pUnkOuter LPUNKNOWN pUnkOuter
) )
{ {
return DD_OK; DX_STUB;
} }

View file

@ -3,7 +3,7 @@
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS * PROJECT: ReactOS
* FILE: lib/ddraw/main/clipper.c * FILE: lib/ddraw/main/clipper.c
* PURPOSE: DirectDraw Implementation * PURPOSE: IDirectDrawClipper Implementation
* PROGRAMMER: Maarten Bosma * PROGRAMMER: Maarten Bosma
* *
*/ */

View file

@ -3,7 +3,7 @@
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS * PROJECT: ReactOS
* FILE: lib/ddraw/main/color.c * FILE: lib/ddraw/main/color.c
* PURPOSE: DirectDraw Implementation * PURPOSE: IDirectDrawColorControl Implementation
* PROGRAMMER: Maarten Bosma * PROGRAMMER: Maarten Bosma
* *
*/ */

View file

@ -3,7 +3,7 @@
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS * PROJECT: ReactOS
* FILE: lib/ddraw/main/ddraw.c * FILE: lib/ddraw/main/ddraw.c
* PURPOSE: DirectDraw Implementation * PURPOSE: IDirectDraw7 Implementation
* PROGRAMMER: Magnus Olsen, Maarten Bosma * PROGRAMMER: Magnus Olsen, Maarten Bosma
* *
*/ */
@ -140,7 +140,9 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
if (That == NULL) if (That == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
That->lpVtbl = &DirectDrawSurface_Vtable; That->lpVtbl = &DirectDrawSurface7_Vtable;
That->lpVtbl_v3 = &DDRAW_IDDS3_Thunk_VTable;
That->ref = 1; That->ref = 1;
*ppSurf = (LPDIRECTDRAWSURFACE7)That; *ppSurf = (LPDIRECTDRAWSURFACE7)That;
@ -173,13 +175,39 @@ ULONG WINAPI Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
return ref; return ref;
} }
/**** Stubs ****/ HRESULT WINAPI Main_DirectDraw_QueryInterface (
LPDIRECTDRAW7 iface, REFIID id, LPVOID *obj )
HRESULT WINAPI Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,REFIID refiid,LPVOID *obj)
{ {
DX_STUB; IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
if (IsEqualGUID(&IID_IDirectDraw7, id))
{
*obj = &This->lpVtbl;
}
else if (IsEqualGUID(&IID_IDirectDraw, id))
{
*obj = &This->lpVtbl_v1;
}
else if (IsEqualGUID(&IID_IDirectDraw2, id))
{
*obj = &This->lpVtbl_v2;
}
else if (IsEqualGUID(&IID_IDirectDraw4, id))
{
*obj = &This->lpVtbl_v4;
}
else
{
*obj = NULL;
return E_NOINTERFACE;
}
Main_DirectDraw_AddRef(iface);
return S_OK;
} }
/**** Stubs ****/
HRESULT WINAPI Main_DirectDraw_Compact(LPDIRECTDRAW7 iface) HRESULT WINAPI Main_DirectDraw_Compact(LPDIRECTDRAW7 iface)
{ {
DX_STUB; DX_STUB;
@ -380,7 +408,7 @@ HRESULT WINAPI Main_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface,DWORD a,DWORD* b
DX_STUB; DX_STUB;
} }
IDirectDraw7Vtbl DirectDraw_Vtable = IDirectDraw7Vtbl DirectDraw7_Vtable =
{ {
Main_DirectDraw_QueryInterface, Main_DirectDraw_QueryInterface,
Main_DirectDraw_AddRef, Main_DirectDraw_AddRef,

View file

@ -3,7 +3,7 @@
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS * PROJECT: ReactOS
* FILE: lib/ddraw/main/gamma.c * FILE: lib/ddraw/main/gamma.c
* PURPOSE: DirectDraw Implementation * PURPOSE: IDirectDrawGamma Implementation
* PROGRAMMER: Maarten Bosma * PROGRAMMER: Maarten Bosma
* *
*/ */

View file

@ -3,7 +3,7 @@
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS * PROJECT: ReactOS
* FILE: lib/ddraw/main/palette.c * FILE: lib/ddraw/main/palette.c
* PURPOSE: DirectDraw Implementation * PURPOSE: IDirectDrawPalette Implementation
* PROGRAMMER: Maarten Bosma * PROGRAMMER: Maarten Bosma
* *
*/ */

View file

@ -3,7 +3,7 @@
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS * PROJECT: ReactOS
* FILE: lib/ddraw/main/surface.c * FILE: lib/ddraw/main/surface.c
* PURPOSE: DirectDraw Implementation * PURPOSE: IDirectDrawSurface7 Implementation
* PROGRAMMER: Magnus Olsen, Maarten Bosma * PROGRAMMER: Magnus Olsen, Maarten Bosma
* *
*/ */
@ -113,6 +113,13 @@ ULONG WINAPI Main_DDrawSurface_Release(LPDIRECTDRAWSURFACE7 iface)
/**** Stubs ****/ /**** Stubs ****/
HRESULT WINAPI
Main_DDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
LPVOID* ppObj)
{
DX_STUB;
}
HRESULT WINAPI Main_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst, HRESULT WINAPI Main_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx) LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
{ {
@ -130,13 +137,6 @@ HRESULT WINAPI Main_DDrawSurface_Unlock (LPDIRECTDRAWSURFACE7 iface, LPRECT pRec
DX_STUB; DX_STUB;
} }
HRESULT WINAPI
Main_DDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
LPVOID* ppObj)
{
DX_STUB;
}
HRESULT WINAPI HRESULT WINAPI
Main_DDrawSurface_AddAttachedSurface(LPDIRECTDRAWSURFACE7 iface, Main_DDrawSurface_AddAttachedSurface(LPDIRECTDRAWSURFACE7 iface,
LPDIRECTDRAWSURFACE7 pAttach) LPDIRECTDRAWSURFACE7 pAttach)
@ -421,7 +421,7 @@ HRESULT WINAPI Main_DDrawSurface_UpdateOverlayZOrder (LPDIRECTDRAWSURFACE7 iface
DX_STUB; DX_STUB;
} }
IDirectDrawSurface7Vtbl DirectDrawSurface_Vtable = IDirectDrawSurface7Vtbl DirectDrawSurface7_Vtable =
{ {
Main_DDrawSurface_QueryInterface, Main_DDrawSurface_QueryInterface,
Main_DDrawSurface_AddRef, Main_DDrawSurface_AddRef,

View file

@ -3,7 +3,6 @@
/********* Includes *********/ /********* Includes *********/
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <ddraw.h> #include <ddraw.h>
@ -16,6 +15,10 @@
typedef struct typedef struct
{ {
IDirectDraw7Vtbl* lpVtbl; IDirectDraw7Vtbl* lpVtbl;
IDirectDraw4Vtbl* lpVtbl_v4;
IDirectDraw2Vtbl* lpVtbl_v2;
IDirectDrawVtbl* lpVtbl_v1;
DDRAWI_DIRECTDRAW_GBL DirectDrawGlobal; DDRAWI_DIRECTDRAW_GBL DirectDrawGlobal;
DDHALINFO HalInfo; DDHALINFO HalInfo;
@ -33,6 +36,8 @@ typedef struct
typedef struct typedef struct
{ {
IDirectDrawSurface7Vtbl* lpVtbl; IDirectDrawSurface7Vtbl* lpVtbl;
IDirectDrawSurface3Vtbl* lpVtbl_v3;
LONG ref; LONG ref;
IDirectDrawImpl* owner; IDirectDrawImpl* owner;
@ -63,8 +68,14 @@ typedef struct
/*********** VTables ************/ /*********** VTables ************/
extern IDirectDraw7Vtbl DirectDraw_Vtable; extern IDirectDraw7Vtbl DirectDraw7_Vtable;
extern IDirectDrawSurface7Vtbl DirectDrawSurface_Vtable; extern IDirectDrawVtbl DDRAW_IDirectDraw_VTable;
extern IDirectDraw2Vtbl DDRAW_IDirectDraw2_VTable;
extern IDirectDraw4Vtbl DDRAW_IDirectDraw4_VTable;
extern IDirectDrawSurface7Vtbl DirectDrawSurface7_Vtable;
extern IDirectDrawSurface3Vtbl DDRAW_IDDS3_Thunk_VTable;
extern IDirectDrawPaletteVtbl DirectDrawPalette_Vtable; extern IDirectDrawPaletteVtbl DirectDrawPalette_Vtable;
extern IDirectDrawClipperVtbl DirectDrawClipper_Vtable; extern IDirectDrawClipperVtbl DirectDrawClipper_Vtable;
extern IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable; extern IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,430 @@
/* IDirectDrawSurface3 -> IDirectDrawSurface7 thunks
* Copyright 2000 TransGaming Technologies Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Taken form wine (wine/dlls/ddraw/surface_thunks.c rev 1.2)
* with some little changes
*
*/
#include "winedraw.h"
#define CONVERT(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
IDirectDrawSurface3, \
IDirectDrawSurface7, \
(pdds))
#define CONVERT_REV(pdds) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, \
IDirectDrawSurface7, \
IDirectDrawSurface3, \
(pdds))
static HRESULT WINAPI
IDirectDrawSurface3Impl_QueryInterface(LPDIRECTDRAWSURFACE3 This, REFIID iid,
LPVOID *ppObj)
{
return IDirectDrawSurface7_QueryInterface(CONVERT(This), iid, ppObj);
}
static ULONG WINAPI
IDirectDrawSurface3Impl_AddRef(LPDIRECTDRAWSURFACE3 This)
{
return IDirectDrawSurface7_AddRef(CONVERT(This));
}
static ULONG WINAPI
IDirectDrawSurface3Impl_Release(LPDIRECTDRAWSURFACE3 This)
{
return IDirectDrawSurface7_Release(CONVERT(This));
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_AddAttachedSurface(LPDIRECTDRAWSURFACE3 This,
LPDIRECTDRAWSURFACE3 pAttach)
{
return IDirectDrawSurface7_AddAttachedSurface(CONVERT(This),
CONVERT(pAttach));
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE3 This,
LPRECT pRect)
{
return IDirectDrawSurface7_AddOverlayDirtyRect(CONVERT(This), pRect);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_Blt(LPDIRECTDRAWSURFACE3 This, LPRECT prcDst,
LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
DWORD dwFlags, LPDDBLTFX pFX)
{
return IDirectDrawSurface7_Blt(CONVERT(This), prcDst, CONVERT(pSrcSurf),
prcSrc, dwFlags, pFX);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_BltBatch(LPDIRECTDRAWSURFACE3 This,
LPDDBLTBATCH pBatch, DWORD dwCount,
DWORD dwFlags)
{
return IDirectDrawSurface7_BltBatch(CONVERT(This), pBatch, dwCount,
dwFlags);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_BltFast(LPDIRECTDRAWSURFACE3 This, DWORD x, DWORD y,
LPDIRECTDRAWSURFACE3 pSrcSurf, LPRECT prcSrc,
DWORD dwTrans)
{
return IDirectDrawSurface7_BltFast(CONVERT(This), x, y, CONVERT(pSrcSurf),
prcSrc, dwTrans);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_DeleteAttachedSurface(LPDIRECTDRAWSURFACE3 This,
DWORD dwFlags,
LPDIRECTDRAWSURFACE3 pAttached)
{
return IDirectDrawSurface7_DeleteAttachedSurface(CONVERT(This), dwFlags,
CONVERT(pAttached));
}
struct callback_info
{
LPDDENUMSURFACESCALLBACK callback;
LPVOID context;
};
static HRESULT CALLBACK
EnumCallback(LPDIRECTDRAWSURFACE7 iface, LPDDSURFACEDESC2 pDDSD,
LPVOID context)
{
const struct callback_info* info = context;
#if 0
/* This is an outgoing conversion so we have to do it. */
DDSURFACEDESC ddsd;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
DDRAW_Convert_DDSURFACEDESC_2_To_1(pDDSD, &ddsd);
#endif
/* the LPDDSURFACEDESC2 -> LPDDSURFACEDESC coercion is safe, since
* the data format is compatible with older enum procs */
return info->callback((LPDIRECTDRAWSURFACE)CONVERT_REV(iface), (LPDDSURFACEDESC)pDDSD,
info->context);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE3 This,
LPVOID context,
LPDDENUMSURFACESCALLBACK callback)
{
struct callback_info info;
info.callback = callback;
info.context = context;
return IDirectDrawSurface7_EnumAttachedSurfaces(CONVERT(This), &info,
EnumCallback);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_EnumOverlayZOrders(LPDIRECTDRAWSURFACE3 This,
DWORD dwFlags, LPVOID context,
LPDDENUMSURFACESCALLBACK callback)
{
struct callback_info info;
info.callback = callback;
info.context = context;
return IDirectDrawSurface7_EnumOverlayZOrders(CONVERT(This), dwFlags,
&info, EnumCallback);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_Flip(LPDIRECTDRAWSURFACE3 This,
LPDIRECTDRAWSURFACE3 pOverride, DWORD dwFlags)
{
return IDirectDrawSurface7_Flip(CONVERT(This), CONVERT(pOverride),
dwFlags);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetAttachedSurface(LPDIRECTDRAWSURFACE3 This,
LPDDSCAPS pCaps,
LPDIRECTDRAWSURFACE3* ppAttached)
{
DDSCAPS2 caps;
LPDIRECTDRAWSURFACE7 pAttached7;
HRESULT hr;
caps.dwCaps = pCaps->dwCaps;
caps.dwCaps2 = 0;
caps.dwCaps3 = 0;
caps.dwCaps4 = 0;
hr = IDirectDrawSurface7_GetAttachedSurface(CONVERT(This), &caps,
&pAttached7);
if (FAILED(hr)) return hr;
*ppAttached = CONVERT_REV(pAttached7);
return hr;
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetBltStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
{
return IDirectDrawSurface7_GetBltStatus(CONVERT(This), dwFlags);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetCaps(LPDIRECTDRAWSURFACE3 This, LPDDSCAPS pCaps)
{
DDSCAPS2 caps;
HRESULT hr;
hr = IDirectDrawSurface7_GetCaps(CONVERT(This), &caps);
if (FAILED(hr)) return hr;
pCaps->dwCaps = caps.dwCaps;
return hr;
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetClipper(LPDIRECTDRAWSURFACE3 This,
LPDIRECTDRAWCLIPPER* ppClipper)
{
return IDirectDrawSurface7_GetClipper(CONVERT(This), ppClipper);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
LPDDCOLORKEY pCKey)
{
return IDirectDrawSurface7_GetColorKey(CONVERT(This), dwFlags, pCKey);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetDC(LPDIRECTDRAWSURFACE3 This, HDC* phDC)
{
return IDirectDrawSurface7_GetDC(CONVERT(This), phDC);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetFlipStatus(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
{
return IDirectDrawSurface7_GetFlipStatus(CONVERT(This), dwFlags);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LPLONG pX,
LPLONG pY)
{
return IDirectDrawSurface7_GetOverlayPosition(CONVERT(This), pX, pY);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetPalette(LPDIRECTDRAWSURFACE3 This,
LPDIRECTDRAWPALETTE* ppPalette)
{
return IDirectDrawSurface7_GetPalette(CONVERT(This), ppPalette);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetPixelFormat(LPDIRECTDRAWSURFACE3 This,
LPDDPIXELFORMAT pPixelFormat)
{
return IDirectDrawSurface7_GetPixelFormat(CONVERT(This), pPixelFormat);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
LPDDSURFACEDESC pDDSD)
{
return IDirectDrawSurface7_GetSurfaceDesc(CONVERT(This),
(LPDDSURFACEDESC2)pDDSD);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_Initialize(LPDIRECTDRAWSURFACE3 This, LPDIRECTDRAW pDD,
LPDDSURFACEDESC pDDSD)
{
return IDirectDrawSurface7_Initialize(CONVERT(This), pDD,
(LPDDSURFACEDESC2)pDDSD);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_IsLost(LPDIRECTDRAWSURFACE3 This)
{
return IDirectDrawSurface7_IsLost(CONVERT(This));
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_Lock(LPDIRECTDRAWSURFACE3 This, LPRECT pRect,
LPDDSURFACEDESC pDDSD, DWORD dwFlags, HANDLE h)
{
return IDirectDrawSurface7_Lock(CONVERT(This), pRect,
(LPDDSURFACEDESC2)pDDSD, dwFlags, h);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_ReleaseDC(LPDIRECTDRAWSURFACE3 This, HDC hDC)
{
return IDirectDrawSurface7_ReleaseDC(CONVERT(This), hDC);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_Restore(LPDIRECTDRAWSURFACE3 This)
{
return IDirectDrawSurface7_Restore(CONVERT(This));
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_SetClipper(LPDIRECTDRAWSURFACE3 This,
LPDIRECTDRAWCLIPPER pClipper)
{
return IDirectDrawSurface7_SetClipper(CONVERT(This), pClipper);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_SetColorKey(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags,
LPDDCOLORKEY pCKey)
{
return IDirectDrawSurface7_SetColorKey(CONVERT(This), dwFlags, pCKey);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_SetOverlayPosition(LPDIRECTDRAWSURFACE3 This, LONG x,
LONG y)
{
return IDirectDrawSurface7_SetOverlayPosition(CONVERT(This), x, y);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_SetPalette(LPDIRECTDRAWSURFACE3 This,
LPDIRECTDRAWPALETTE pPalette)
{
return IDirectDrawSurface7_SetPalette(CONVERT(This), pPalette);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_Unlock(LPDIRECTDRAWSURFACE3 This, LPVOID data)
{
/* data might not be the LPRECT of later versions, so drop it. */
return IDirectDrawSurface7_Unlock(CONVERT(This), NULL);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_UpdateOverlay(LPDIRECTDRAWSURFACE3 This, LPRECT prcSrc,
LPDIRECTDRAWSURFACE3 pDstSurf,
LPRECT prcDst, DWORD dwFlags,
LPDDOVERLAYFX pFX)
{
return IDirectDrawSurface7_UpdateOverlay(CONVERT(This), prcSrc,
CONVERT(pDstSurf), prcDst,
dwFlags, pFX);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE3 This,
DWORD dwFlags)
{
return IDirectDrawSurface7_UpdateOverlayDisplay(CONVERT(This), dwFlags);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE3 This,
DWORD dwFlags,
LPDIRECTDRAWSURFACE3 pSurfReference)
{
return IDirectDrawSurface7_UpdateOverlayZOrder(CONVERT(This), dwFlags,
CONVERT(pSurfReference));
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_GetDDInterface(LPDIRECTDRAWSURFACE3 This, LPVOID* ppDD)
{
return IDirectDrawSurface7_GetDDInterface(CONVERT(This), ppDD);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_PageLock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
{
return IDirectDrawSurface7_PageLock(CONVERT(This), dwFlags);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_PageUnlock(LPDIRECTDRAWSURFACE3 This, DWORD dwFlags)
{
return IDirectDrawSurface7_PageUnlock(CONVERT(This), dwFlags);
}
static HRESULT WINAPI
IDirectDrawSurface3Impl_SetSurfaceDesc(LPDIRECTDRAWSURFACE3 This,
LPDDSURFACEDESC pDDSD, DWORD dwFlags)
{
return IDirectDrawSurface7_SetSurfaceDesc(CONVERT(This),
(LPDDSURFACEDESC2)pDDSD,
dwFlags);
}
IDirectDrawSurface3Vtbl DDRAW_IDDS3_Thunk_VTable =
{
IDirectDrawSurface3Impl_QueryInterface,
IDirectDrawSurface3Impl_AddRef,
IDirectDrawSurface3Impl_Release,
IDirectDrawSurface3Impl_AddAttachedSurface,
IDirectDrawSurface3Impl_AddOverlayDirtyRect,
IDirectDrawSurface3Impl_Blt,
IDirectDrawSurface3Impl_BltBatch,
IDirectDrawSurface3Impl_BltFast,
IDirectDrawSurface3Impl_DeleteAttachedSurface,
IDirectDrawSurface3Impl_EnumAttachedSurfaces,
IDirectDrawSurface3Impl_EnumOverlayZOrders,
IDirectDrawSurface3Impl_Flip,
IDirectDrawSurface3Impl_GetAttachedSurface,
IDirectDrawSurface3Impl_GetBltStatus,
IDirectDrawSurface3Impl_GetCaps,
IDirectDrawSurface3Impl_GetClipper,
IDirectDrawSurface3Impl_GetColorKey,
IDirectDrawSurface3Impl_GetDC,
IDirectDrawSurface3Impl_GetFlipStatus,
IDirectDrawSurface3Impl_GetOverlayPosition,
IDirectDrawSurface3Impl_GetPalette,
IDirectDrawSurface3Impl_GetPixelFormat,
IDirectDrawSurface3Impl_GetSurfaceDesc,
IDirectDrawSurface3Impl_Initialize,
IDirectDrawSurface3Impl_IsLost,
IDirectDrawSurface3Impl_Lock,
IDirectDrawSurface3Impl_ReleaseDC,
IDirectDrawSurface3Impl_Restore,
IDirectDrawSurface3Impl_SetClipper,
IDirectDrawSurface3Impl_SetColorKey,
IDirectDrawSurface3Impl_SetOverlayPosition,
IDirectDrawSurface3Impl_SetPalette,
IDirectDrawSurface3Impl_Unlock,
IDirectDrawSurface3Impl_UpdateOverlay,
IDirectDrawSurface3Impl_UpdateOverlayDisplay,
IDirectDrawSurface3Impl_UpdateOverlayZOrder,
IDirectDrawSurface3Impl_GetDDInterface,
IDirectDrawSurface3Impl_PageLock,
IDirectDrawSurface3Impl_PageUnlock,
IDirectDrawSurface3Impl_SetSurfaceDesc
};

View file

@ -0,0 +1,101 @@
/*
* Copyright 2000-2001 TransGaming Technologies Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _DDCOMIMPL_H_
#define _DDCOMIMPL_H_
#include <stddef.h>
/* Generates the name for a vtable pointer for a given interface. */
/* The canonical name for a single interface is "lpVtbl". */
#define ICOM_VFIELD_MULTI_NAME2(iface) ITF_##iface
#define ICOM_VFIELD_MULTI_NAME(iface) ICOM_VFIELD_MULTI_NAME2(iface)
/* Declares a vtable pointer field in an implementation. */
#define ICOM_VFIELD_MULTI(iface) \
iface ICOM_VFIELD_MULTI_NAME(iface)
/* Returns the offset of a vtable pointer within an implementation object. */
#define ICOM_VFIELD_OFFSET(impltype, iface) \
offsetof(impltype, ICOM_VFIELD_MULTI_NAME(iface))
/* Given an interface pointer, returns the implementation pointer. */
#define ICOM_OBJECT(impltype, ifacename, ifaceptr) \
(impltype*)((ifaceptr) == NULL ? NULL \
: (char*)(ifaceptr) - ICOM_VFIELD_OFFSET(impltype,ifacename))
#define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \
impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr)
/* Given an object and interface name, returns a pointer to that interface. */
#define ICOM_INTERFACE(implobj, iface) \
(&((implobj)->ICOM_VFIELD_MULTI_NAME(iface)))
#define ICOM_INIT_INTERFACE(implobj, ifacename, vtblname) \
do { \
(implobj)->ICOM_VFIELD_MULTI_NAME(ifacename).lpVtbl = &(vtblname); \
} while (0)
#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)
#endif /* _DDCOMIMPL_H_ */
#ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
#define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
/* MAY NOT CONTAIN X11 or DGA specific includes/defines/structs! */
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "wingdi.h"
#include "winuser.h"
#include "ddraw.h"
#include "d3d.h"
#include "ddrawi.h"
/*****************************************************************************
* IDirectDraw implementation structure
*/
typedef struct IDirectDrawImpl IDirectDrawImpl;
typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl;
struct IDirectDrawImpl
{
ICOM_VFIELD_MULTI(IDirectDraw7);
ICOM_VFIELD_MULTI(IDirectDraw4);
ICOM_VFIELD_MULTI(IDirectDraw2);
ICOM_VFIELD_MULTI(IDirectDraw);
};
/*****************************************************************************
* IDirectDrawSurface implementation structure
*/
struct IDirectDrawSurfaceImpl
{
/* IUnknown fields */
ICOM_VFIELD_MULTI(IDirectDrawSurface7);
ICOM_VFIELD_MULTI(IDirectDrawSurface3);
};
#endif /* __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H */