Initialize the back-buffer with the correct VTable.

This commit is contained in:
Lionel Ulmer 2000-05-23 01:21:47 +00:00 committed by Alexandre Julliard
parent 7e5c2c042a
commit 79457d818c
3 changed files with 9 additions and 15 deletions

View File

@ -60,9 +60,9 @@ static XF86VidModeModeInfo *orig_mode = NULL;
/* This function is used both by DGA and DGA2 drivers, thus the virtual function table
is not set here, but in the calling function */
HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_no_VT(
HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_with_VT(
LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsd,LPDIRECTDRAWSURFACE *lpdsf,
IUnknown *lpunk
IUnknown *lpunk, void *vtable
) {
ICOM_THIS(IDirectDraw2Impl,iface);
IDirectDrawSurfaceImpl* dsurf;
@ -84,6 +84,8 @@ HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_no_VT(
HEAP_ZERO_MEMORY,
sizeof(dga_ds_private)
);
ICOM_VTBL(dsurf) = (ICOM_VTABLE(IDirectDrawSurface)*)vtable;
dspriv = (dga_ds_private*)dsurf->private;
IDirectDraw2_AddRef(iface);
@ -148,7 +150,7 @@ HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_no_VT(
);
IDirectDraw2_AddRef(iface);
back->ref = 1;
ICOM_VTBL(back) = (ICOM_VTABLE(IDirectDrawSurface4)*)&dga_dds4vt;
ICOM_VTBL(back) = (ICOM_VTABLE(IDirectDrawSurface4)*)vtable;
back->private = HeapAlloc(
GetProcessHeap(),
HEAP_ZERO_MEMORY,
@ -196,12 +198,8 @@ static HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface(
IUnknown *lpunk
) {
HRESULT ret;
IDirectDrawSurfaceImpl* dsurf;
ret = DGA_IDirectDraw2Impl_CreateSurface_no_VT(iface, lpddsd, lpdsf, lpunk);
dsurf = *(IDirectDrawSurfaceImpl**)lpdsf;
ICOM_VTBL(dsurf) = (ICOM_VTABLE(IDirectDrawSurface)*)&dga_dds4vt;
ret = DGA_IDirectDraw2Impl_CreateSurface_with_VT(iface, lpddsd, lpdsf, lpunk, &dga_dds4vt);
return ret;
}

View File

@ -40,12 +40,8 @@ static HRESULT WINAPI DGA2_IDirectDraw2Impl_CreateSurface(
IUnknown *lpunk
) {
HRESULT ret;
IDirectDrawSurfaceImpl* dsurf;
ret = DGA_IDirectDraw2Impl_CreateSurface_no_VT(iface, lpddsd, lpdsf, lpunk);
dsurf = *(IDirectDrawSurfaceImpl**)lpdsf;
ICOM_VTBL(dsurf) = (ICOM_VTABLE(IDirectDrawSurface)*)&dga2_dds4vt;
ret = DGA_IDirectDraw2Impl_CreateSurface_with_VT(iface, lpddsd, lpdsf, lpunk, &dga2_dds4vt);
return ret;
}

View File

@ -37,8 +37,8 @@ extern HRESULT WINAPI DGA_IDirectDrawSurface4Impl_SetPalette(LPDIRECTDRAWSURFACE
extern HRESULT WINAPI DGA_IDirectDrawSurface4Impl_Unlock(LPDIRECTDRAWSURFACE4 iface,LPVOID surface) ;
extern HRESULT WINAPI DGA_IDirectDrawSurface4Impl_GetDC(LPDIRECTDRAWSURFACE4 iface,HDC* lphdc);
extern HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_no_VT(LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsd,
LPDIRECTDRAWSURFACE *lpdsf,IUnknown *lpunk) ;
extern HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_with_VT(LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsd,
LPDIRECTDRAWSURFACE *lpdsf,IUnknown *lpunk, void *vtable) ;
extern HRESULT WINAPI DGA_IDirectDraw2Impl_QueryInterface(LPDIRECTDRAW2 iface,REFIID refiid,LPVOID *obj) ;
extern HRESULT WINAPI DGA_IDirectDraw2Impl_GetCaps(LPDIRECTDRAW2 iface,LPDDCAPS caps1,LPDDCAPS caps2) ;