2005-08-08 13:29:50 +00:00
|
|
|
/* $Id$
|
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
2007-05-12 17:30:37 +00:00
|
|
|
* PROJECT: ReactOS DirectX
|
|
|
|
* FILE: ddraw/surface/surface_main.c
|
2007-10-19 23:21:45 +00:00
|
|
|
* PURPOSE: IDirectDrawSurface7 Implementation
|
2005-08-08 13:29:50 +00:00
|
|
|
* PROGRAMMER: Magnus Olsen, Maarten Bosma
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-05-15 16:18:30 +00:00
|
|
|
#include "rosdraw.h"
|
2005-08-08 13:29:50 +00:00
|
|
|
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
/* FIXME adding hal and hel stub
|
|
|
|
DestroySurface;
|
2006-04-08 21:05:49 +00:00
|
|
|
SetClipList;
|
2007-10-19 23:21:45 +00:00
|
|
|
AddAttachedSurface;
|
2006-04-08 21:05:49 +00:00
|
|
|
GetFlipStatus;
|
2007-10-19 23:21:45 +00:00
|
|
|
SetOverlayPosition;
|
2006-04-08 21:05:49 +00:00
|
|
|
SetPalette;
|
|
|
|
*/
|
|
|
|
|
2007-12-12 15:01:25 +00:00
|
|
|
LPDDRAWI_DDRAWSURFACE_INT
|
|
|
|
internal_directdrawsurface_int_alloc(LPDDRAWI_DDRAWSURFACE_INT This)
|
|
|
|
{
|
|
|
|
LPDDRAWI_DDRAWSURFACE_INT newThis;
|
2008-09-25 19:26:09 +00:00
|
|
|
DxHeapMemAlloc(newThis, sizeof(DDRAWI_DDRAWSURFACE_INT));
|
2007-12-12 15:01:25 +00:00
|
|
|
if (newThis)
|
|
|
|
{
|
|
|
|
newThis->lpLcl = This->lpLcl;
|
|
|
|
newThis->lpLink = This;
|
|
|
|
}
|
|
|
|
return newThis;
|
|
|
|
}
|
2006-04-02 15:04:09 +00:00
|
|
|
|
2007-12-16 14:07:33 +00:00
|
|
|
HRESULT WINAPI Main_DDrawSurface_Initialize (LPDDRAWI_DDRAWSURFACE_INT iface, LPDIRECTDRAW pDD, LPDDSURFACEDESC2 pDDSD2)
|
2006-12-13 21:48:35 +00:00
|
|
|
{
|
|
|
|
return DDERR_ALREADYINITIALIZED;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
2007-12-16 14:07:33 +00:00
|
|
|
ULONG WINAPI Main_DDrawSurface_AddRef(LPDDRAWI_DDRAWSURFACE_INT This)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
2006-12-13 21:48:35 +00:00
|
|
|
|
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2007-12-12 15:01:25 +00:00
|
|
|
if (This!=NULL)
|
2006-12-13 21:48:35 +00:00
|
|
|
{
|
|
|
|
This->dwIntRefCnt++;
|
|
|
|
This->lpLcl->dwLocalRefCnt++;
|
|
|
|
|
|
|
|
if (This->lpLcl->lpGbl != NULL)
|
|
|
|
{
|
|
|
|
This->lpLcl->lpGbl->dwRefCnt++;
|
|
|
|
}
|
|
|
|
}
|
2006-11-19 19:13:35 +00:00
|
|
|
return This->dwIntRefCnt;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
2007-06-16 16:42:50 +00:00
|
|
|
HRESULT WINAPI
|
2007-12-13 01:55:06 +00:00
|
|
|
Main_DDrawSurface_QueryInterface(LPDDRAWI_DDRAWSURFACE_INT This, REFIID riid, LPVOID* ppObj)
|
2007-06-16 16:42:50 +00:00
|
|
|
{
|
2007-12-12 15:01:25 +00:00
|
|
|
HRESULT retVal = DD_OK;
|
|
|
|
*ppObj = NULL;
|
2007-06-16 16:42:50 +00:00
|
|
|
|
2008-01-24 20:40:57 +00:00
|
|
|
DX_WINDBG_trace();
|
2007-12-13 01:55:06 +00:00
|
|
|
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_TRY
|
2007-12-12 15:01:25 +00:00
|
|
|
{
|
|
|
|
if (IsEqualGUID(&IID_IDirectDrawSurface7, riid))
|
|
|
|
{
|
|
|
|
if (This->lpVtbl != &DirectDrawSurface7_Vtable)
|
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-12 15:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &DirectDrawSurface7_Vtable;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDirectDrawSurface4, riid))
|
|
|
|
{
|
|
|
|
if (This->lpVtbl != &DirectDrawSurface4_Vtable)
|
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-12 15:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &DirectDrawSurface4_Vtable;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDirectDrawSurface3, riid))
|
|
|
|
{
|
|
|
|
if (This->lpVtbl != &DirectDrawSurface3_Vtable)
|
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-12 15:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &DirectDrawSurface3_Vtable;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDirectDrawSurface2, riid))
|
|
|
|
{
|
|
|
|
if (This->lpVtbl != &DirectDrawSurface2_Vtable)
|
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-12 15:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &DirectDrawSurface2_Vtable;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDirectDrawSurface, riid))
|
|
|
|
{
|
|
|
|
if (This->lpVtbl != &DirectDrawSurface_Vtable)
|
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-12 15:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &DirectDrawSurface_Vtable;
|
|
|
|
*ppObj = This;
|
2007-12-13 01:55:06 +00:00
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDirectDrawColorControl, riid))
|
|
|
|
{
|
2007-12-13 12:31:05 +00:00
|
|
|
if (This->lpVtbl != &DirectDrawColorControl_Vtable)
|
2007-12-13 01:55:06 +00:00
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-13 01:55:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &DirectDrawColorControl_Vtable;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDirectDrawGammaControl, riid))
|
|
|
|
{
|
2007-12-13 12:31:05 +00:00
|
|
|
if (This->lpVtbl != &DirectDrawGammaControl_Vtable)
|
2007-12-13 01:55:06 +00:00
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-13 01:55:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &DirectDrawGammaControl_Vtable;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDirectDrawSurfaceKernel, riid))
|
|
|
|
{
|
2007-12-13 12:31:05 +00:00
|
|
|
if (This->lpVtbl != &DirectDrawSurfaceKernel_Vtable)
|
2007-12-13 01:55:06 +00:00
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-13 01:55:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &DirectDrawSurfaceKernel_Vtable;
|
|
|
|
*ppObj = This;
|
2007-12-12 15:01:25 +00:00
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
2007-12-13 12:31:05 +00:00
|
|
|
else if (IsEqualGUID(&IID_IDirect3D, riid))
|
|
|
|
{
|
|
|
|
if (This->lpVtbl != &IDirect3D_Vtbl)
|
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-13 12:31:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &IDirect3D_Vtbl;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
2007-12-16 14:07:33 +00:00
|
|
|
else if (IsEqualGUID(&IID_IDirect3D2, riid))
|
|
|
|
{
|
|
|
|
if (This->lpVtbl != &IDirect3D2_Vtbl)
|
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-16 14:07:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &IDirect3D2_Vtbl;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDirect3D3, riid))
|
|
|
|
{
|
|
|
|
if (This->lpVtbl != &IDirect3D3_Vtbl)
|
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-16 14:07:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &IDirect3D3_Vtbl;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDirect3D7, riid))
|
|
|
|
{
|
|
|
|
if (This->lpVtbl != &IDirect3D7_Vtbl)
|
|
|
|
{
|
|
|
|
This = internal_directdrawsurface_int_alloc(This);
|
|
|
|
if (!This)
|
|
|
|
{
|
|
|
|
retVal = DDERR_OUTOFVIDEOMEMORY;
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_LEAVE;
|
2007-12-16 14:07:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
This->lpVtbl = &IDirect3D7_Vtbl;
|
|
|
|
*ppObj = This;
|
|
|
|
Main_DDrawSurface_AddRef(This);
|
|
|
|
}
|
2007-12-12 15:01:25 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
DX_STUB_str("E_NOINTERFACE");
|
|
|
|
retVal = E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2007-12-12 15:01:25 +00:00
|
|
|
{
|
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_END;
|
2007-12-12 15:01:25 +00:00
|
|
|
return retVal;
|
2007-06-16 16:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-13 21:48:35 +00:00
|
|
|
|
2007-12-16 14:07:33 +00:00
|
|
|
ULONG WINAPI Main_DDrawSurface_Release(LPDDRAWI_DDRAWSURFACE_INT This)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
/* FIXME
|
|
|
|
This is not right exiame how it should be done
|
2006-11-19 19:13:35 +00:00
|
|
|
*/
|
2006-12-13 21:48:35 +00:00
|
|
|
DX_STUB_str("FIXME This is not right exiame how it should be done\n");
|
2006-11-19 19:13:35 +00:00
|
|
|
return This->dwIntRefCnt;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
|
2007-12-16 14:07:33 +00:00
|
|
|
HRESULT WINAPI Main_DDrawSurface_Blt(LPDDRAWI_DDRAWSURFACE_INT ThisDest, LPRECT rdst,
|
2009-10-24 14:09:48 +00:00
|
|
|
LPDDRAWI_DDRAWSURFACE_INT ThisSrc, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
2009-10-24 14:09:48 +00:00
|
|
|
DDHAL_BLTDATA mDdBlt;
|
2006-11-05 21:19:53 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
DX_WINDBG_trace();
|
2005-10-30 12:53:32 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
if (ThisDest == NULL)
|
|
|
|
{
|
|
|
|
return DDERR_INVALIDPARAMS;
|
|
|
|
}
|
2006-12-12 19:34:33 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
/* Zero out members in DDHAL_BLTDATA */
|
|
|
|
ZeroMemory(&mDdBlt, sizeof(DDHAL_BLTDATA));
|
|
|
|
ZeroMemory(&mDdBlt.bltFX, sizeof(DDBLTFX));
|
2006-12-12 20:35:12 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
/* Check if we got HAL support for this api */
|
|
|
|
if (( ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
|
|
|
|
DDHAL_SURFCB32_BLT) == DDHAL_SURFCB32_BLT)
|
|
|
|
{
|
|
|
|
mDdBlt.Blt = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->lpGbl->lpDDCBtmp->HALDDSurface.Blt;
|
|
|
|
}
|
|
|
|
/* Check if we got HEL support for this api */
|
|
|
|
else if (( ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HELDDSurface.dwFlags &
|
|
|
|
DDHAL_SURFCB32_BLT) == DDHAL_SURFCB32_BLT)
|
|
|
|
{
|
|
|
|
mDdBlt.Blt = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->lpGbl->lpDDCBtmp->HELDDSurface.Blt;
|
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
if (mDdBlt.Blt == NULL)
|
|
|
|
{
|
|
|
|
/* This API is unsupported */
|
|
|
|
return DDERR_UNSUPPORTED;
|
|
|
|
}
|
2006-12-12 19:34:33 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
/* Prepare for draw, if we do not reset the DdResetVisrgn some graphics card will not draw on the screen */
|
|
|
|
if (!DdResetVisrgn( ThisDest->lpLcl->lpSurfMore->slist[0], NULL))
|
|
|
|
{
|
|
|
|
DX_STUB_str("DdResetVisrgn failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
mDdBlt.lpDD = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->lpGbl;
|
|
|
|
mDdBlt.lpDDDestSurface = ThisDest->lpLcl->lpSurfMore->slist[0];
|
|
|
|
ThisDest->lpLcl->lpSurfMore->slist[0]->hDC = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->hDC;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
/* Setup Src */
|
|
|
|
if (( ThisSrc != NULL ) )
|
|
|
|
{
|
|
|
|
|
|
|
|
mDdBlt.lpDDSrcSurface = ThisSrc->lpLcl->lpSurfMore->slist[0];
|
|
|
|
ThisSrc->lpLcl->lpSurfMore->slist[0]->hDC = ThisSrc->lpLcl->lpSurfMore->lpDD_lcl->hDC;
|
|
|
|
|
|
|
|
if (rsrc != NULL)
|
|
|
|
{
|
|
|
|
memmove(&mDdBlt.rSrc, rsrc, sizeof (RECTL));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!GetWindowRect((HWND)ThisSrc->lpLcl->lpSurfMore->lpDD_lcl->hWnd,
|
|
|
|
(RECT *)&mDdBlt.rSrc))
|
|
|
|
{
|
|
|
|
DX_STUB_str("GetWindowRect failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME
|
|
|
|
* compare so we do not write too far
|
|
|
|
* ThisDest->lpLcl->lpGbl->wWidth; <- surface max width
|
|
|
|
* ThisDest->lpLcl->lpGbl->wHeight <- surface max heght
|
|
|
|
* ThisDest->lpLcl->lpGbl->lPitch <- surface bpp
|
|
|
|
*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup dest */
|
|
|
|
if (rdst != NULL)
|
|
|
|
{
|
|
|
|
memmove(&mDdBlt.rDest, rdst, sizeof (RECTL));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!GetWindowRect((HWND)ThisDest->lpLcl->lpSurfMore->lpDD_lcl->hWnd,
|
|
|
|
(RECT *)&mDdBlt.rDest))
|
|
|
|
{
|
|
|
|
DX_STUB_str("GetWindowRect failed");
|
|
|
|
}
|
|
|
|
}
|
2006-12-12 20:35:12 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
/* FIXME
|
|
|
|
* compare so we do not write too far
|
|
|
|
* ThisDest->lpLcl->lpGbl->wWidth; <- surface max width
|
|
|
|
* ThisDest->lpLcl->lpGbl->wHeight <- surface max heght
|
|
|
|
* ThisDest->lpLcl->lpGbl->lPitch <- surface bpp
|
|
|
|
*/
|
2006-12-12 20:35:12 +00:00
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
/* setup bltFX */
|
|
|
|
if (lpbltfx != NULL)
|
|
|
|
{
|
|
|
|
memmove(&mDdBlt.bltFX, lpbltfx, sizeof (DDBLTFX));
|
|
|
|
}
|
2006-12-12 20:35:12 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
/* setup value that are not config yet */
|
|
|
|
mDdBlt.dwFlags = dwFlags;
|
|
|
|
mDdBlt.IsClipped = FALSE;
|
|
|
|
mDdBlt.bltFX.dwSize = sizeof(DDBLTFX);
|
2006-12-12 20:35:12 +00:00
|
|
|
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
/* FIXME
|
2009-10-24 14:09:48 +00:00
|
|
|
BltData.dwRectCnt
|
|
|
|
BltData.dwROPFlags
|
|
|
|
BltData.IsClipped
|
|
|
|
BltData.prDestRects
|
|
|
|
BltData.rOrigDest
|
|
|
|
BltData.rOrigSrc
|
|
|
|
BltData.ddRVal
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (mDdBlt.Blt(&mDdBlt) != DDHAL_DRIVER_HANDLED)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
DX_STUB_str("mDdBlt DDHAL_DRIVER_HANDLED");
|
2009-10-24 14:09:48 +00:00
|
|
|
return DDERR_NOBLTHW;
|
2006-12-12 19:34:33 +00:00
|
|
|
}
|
2006-11-19 19:13:35 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
return mDdBlt.ddRVal;
|
2005-10-23 17:53:19 +00:00
|
|
|
}
|
|
|
|
|
2005-10-30 12:53:32 +00:00
|
|
|
|
2007-12-01 19:45:17 +00:00
|
|
|
HRESULT WINAPI
|
2009-10-24 14:09:48 +00:00
|
|
|
Main_DDrawSurface_Lock (LPDDRAWI_DDRAWSURFACE_INT ThisDest, LPRECT prect,
|
2007-12-01 19:45:17 +00:00
|
|
|
LPDDSURFACEDESC2 pDDSD, DWORD flags, HANDLE events)
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
2007-12-01 19:45:17 +00:00
|
|
|
DDHAL_LOCKDATA mdLock;
|
2006-04-02 15:04:09 +00:00
|
|
|
|
2007-12-01 19:45:17 +00:00
|
|
|
DX_WINDBG_trace();
|
2006-11-05 21:19:53 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
DX_WINDBG_trace_res( (DWORD)ThisDest->lpLcl->lpGbl->wWidth, (DWORD)ThisDest->lpLcl->lpGbl->wHeight, (DWORD)ThisDest->lpLcl->lpGbl->lPitch, (DWORD) 0);
|
|
|
|
|
|
|
|
/* Zero out members in DDHAL_LOCKDATA */
|
|
|
|
ZeroMemory(&mdLock, sizeof(DDHAL_LOCKDATA));
|
|
|
|
|
|
|
|
/* Check if we got HAL support for this api */
|
|
|
|
if (( ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
|
|
|
|
DDHAL_SURFCB32_LOCK) == DDHAL_SURFCB32_LOCK)
|
|
|
|
{
|
|
|
|
mdLock.Lock = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->lpGbl->lpDDCBtmp->HALDDSurface.Lock;
|
|
|
|
}
|
|
|
|
/* Check if we got HEL support for this api */
|
|
|
|
else if (( ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HELDDSurface.dwFlags &
|
|
|
|
DDHAL_SURFCB32_LOCK) == DDHAL_SURFCB32_LOCK)
|
|
|
|
{
|
|
|
|
mdLock.Lock = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->lpGbl->lpDDCBtmp->HELDDSurface.Lock;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mdLock.Lock == NULL)
|
|
|
|
{
|
|
|
|
/* This api are unsupported */
|
|
|
|
return DDERR_UNSUPPORTED;
|
|
|
|
}
|
2006-12-12 22:03:49 +00:00
|
|
|
|
2007-12-01 19:45:17 +00:00
|
|
|
if (events != NULL)
|
|
|
|
{
|
|
|
|
return DDERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME add a check see if lock suport or not */
|
|
|
|
|
|
|
|
if (prect!=NULL)
|
2006-04-08 23:01:04 +00:00
|
|
|
{
|
2006-12-12 22:03:49 +00:00
|
|
|
mdLock.bHasRect = TRUE;
|
|
|
|
memcpy(&mdLock.rArea,prect,sizeof(RECTL));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
mdLock.bHasRect = FALSE;
|
2006-04-08 23:01:04 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2007-12-01 19:45:17 +00:00
|
|
|
//FIXME check if it primary or not and use primary or pixelformat data, at moment it is hardcode to primary
|
2007-06-24 17:29:03 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
mdLock.ddRVal = DDERR_CANTLOCKSURFACE;
|
2006-12-12 22:03:49 +00:00
|
|
|
mdLock.dwFlags = flags;
|
2009-10-24 14:09:48 +00:00
|
|
|
mdLock.lpDDSurface = ThisDest->lpLcl->lpSurfMore->slist[0];
|
|
|
|
mdLock.lpDD = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->lpGbl;
|
2006-12-12 22:03:49 +00:00
|
|
|
mdLock.lpSurfData = NULL;
|
2007-06-24 17:29:03 +00:00
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
if (!DdResetVisrgn(ThisDest->lpLcl->lpSurfMore->slist[0], NULL))
|
2006-12-12 22:03:49 +00:00
|
|
|
{
|
|
|
|
DX_STUB_str("Here DdResetVisrgn lock");
|
2009-10-24 14:09:48 +00:00
|
|
|
// return DDERR_UNSUPPORTED;
|
2006-12-12 22:03:49 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-12-12 22:03:49 +00:00
|
|
|
if (mdLock.Lock(&mdLock)!= DDHAL_DRIVER_HANDLED)
|
|
|
|
{
|
|
|
|
DX_STUB_str("Here DDHAL_DRIVER_HANDLED lock");
|
|
|
|
return DDERR_UNSUPPORTED;
|
2007-10-19 23:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME ??? is this right ??
|
2007-06-24 17:29:03 +00:00
|
|
|
|
2006-12-12 22:03:49 +00:00
|
|
|
if (pDDSD != NULL)
|
|
|
|
{
|
2007-12-01 19:45:17 +00:00
|
|
|
ZeroMemory(pDDSD,sizeof(DDSURFACEDESC2));
|
|
|
|
pDDSD->dwSize = sizeof(DDSURFACEDESC2);
|
2006-12-12 22:03:49 +00:00
|
|
|
|
|
|
|
//if (pDDSD->dwSize == sizeof(DDSURFACEDESC2))
|
|
|
|
//{
|
|
|
|
// ZeroMemory(pDDSD,sizeof(DDSURFACEDESC2));
|
|
|
|
// // FIXME the interanl mddsdPrimary shall be DDSURFACEDESC2
|
|
|
|
// memcpy(pDDSD,&This->Surf->mddsdPrimary,sizeof(DDSURFACEDESC));
|
|
|
|
// pDDSD->dwSize = sizeof(DDSURFACEDESC2);
|
|
|
|
//}
|
|
|
|
//if (pDDSD->dwSize == sizeof(DDSURFACEDESC))
|
|
|
|
//{
|
|
|
|
// RtlZeroMemory(pDDSD,sizeof(DDSURFACEDESC));
|
|
|
|
// memcpy(pDDSD,&This->Surf->mddsdPrimary,sizeof(DDSURFACEDESC));
|
|
|
|
// pDDSD->dwSize = sizeof(DDSURFACEDESC);
|
|
|
|
//}
|
|
|
|
|
2007-06-24 17:29:03 +00:00
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
pDDSD->lpSurface = (LPVOID) mdLock.lpSurfData;
|
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
pDDSD->dwHeight = ThisDest->lpLcl->lpGbl->wHeight;
|
|
|
|
pDDSD->dwWidth = ThisDest->lpLcl->lpGbl->wWidth;
|
2007-06-24 17:29:03 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
pDDSD->ddpfPixelFormat.dwRGBBitCount = ThisDest->lpLcl->lpGbl->lpDD->lpModeInfo->dwBPP;// .lpModeInfo->dwBPP; //This->lpLcl->lpGbl->lPitch/ 8;
|
|
|
|
pDDSD->lPitch = ThisDest->lpLcl->lpGbl->lPitch;
|
2007-12-01 19:45:17 +00:00
|
|
|
pDDSD->dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH;
|
2006-12-12 22:03:49 +00:00
|
|
|
}
|
2007-06-24 17:29:03 +00:00
|
|
|
|
2006-12-13 07:54:45 +00:00
|
|
|
return mdLock.ddRVal;
|
2005-10-23 17:53:19 +00:00
|
|
|
}
|
|
|
|
|
2006-12-12 22:03:49 +00:00
|
|
|
|
2007-12-16 14:07:33 +00:00
|
|
|
HRESULT WINAPI Main_DDrawSurface_Unlock (LPDDRAWI_DDRAWSURFACE_INT This, LPRECT pRect)
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
2009-10-24 14:09:48 +00:00
|
|
|
DDHAL_UNLOCKDATA mdUnLock;
|
|
|
|
|
|
|
|
DX_WINDBG_trace();
|
2006-04-08 21:05:49 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
/* Zero out members in DDHAL_UNLOCKDATA */
|
|
|
|
ZeroMemory(&mdUnLock, sizeof(DDHAL_UNLOCKDATA));
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-10-24 14:09:48 +00:00
|
|
|
/* Check if we got HAL support for this api */
|
|
|
|
if (( This->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
|
|
|
|
DDHAL_SURFCB32_UNLOCK) == DDHAL_SURFCB32_UNLOCK)
|
|
|
|
{
|
|
|
|
mdUnLock.Unlock = This->lpLcl->lpSurfMore->lpDD_lcl->lpGbl->lpDDCBtmp->HALDDSurface.Unlock;
|
|
|
|
}
|
|
|
|
/* Check if we got HEL support for this api */
|
|
|
|
else if (( This->lpLcl->lpGbl->lpDD->lpDDCBtmp->HELDDSurface.dwFlags &
|
|
|
|
DDHAL_SURFCB32_UNLOCK) == DDHAL_SURFCB32_UNLOCK)
|
|
|
|
{
|
|
|
|
mdUnLock.Unlock = This->lpLcl->lpSurfMore->lpDD_lcl->lpGbl->lpDDCBtmp->HELDDSurface.Unlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mdUnLock.Unlock == NULL)
|
|
|
|
{
|
|
|
|
/* This api are unsupported */
|
|
|
|
return DDERR_UNSUPPORTED;
|
|
|
|
}
|
2006-04-08 21:05:49 +00:00
|
|
|
|
2006-12-13 08:31:02 +00:00
|
|
|
mdUnLock.ddRVal = DDERR_NOTPALETTIZED;
|
|
|
|
mdUnLock.lpDD = This->lpLcl->lpSurfMore->lpDD_lcl->lpGbl;
|
2009-10-24 14:09:48 +00:00
|
|
|
mdUnLock.lpDDSurface = This->lpLcl->lpSurfMore->slist[0];
|
2006-11-19 19:13:35 +00:00
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
if (!DdResetVisrgn( mdUnLock.lpDDSurface, NULL))
|
|
|
|
{
|
2009-10-24 14:09:48 +00:00
|
|
|
DX_STUB_str("DdResetVisrgn fail");
|
|
|
|
//return DDERR_UNSUPPORTED; /* this can fail */
|
2006-11-19 19:13:35 +00:00
|
|
|
}
|
|
|
|
|
2006-12-13 08:31:02 +00:00
|
|
|
if (mdUnLock.Unlock(&mdUnLock)!= DDHAL_DRIVER_HANDLED)
|
2006-11-19 19:13:35 +00:00
|
|
|
{
|
2009-10-24 14:09:48 +00:00
|
|
|
DX_STUB_str("unLock fail");
|
2006-11-19 19:13:35 +00:00
|
|
|
return DDERR_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
2006-12-13 08:31:02 +00:00
|
|
|
return mdUnLock.ddRVal;
|
2005-10-23 17:53:19 +00:00
|
|
|
}
|
|
|
|
|
2005-08-08 13:29:50 +00:00
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_AddAttachedSurface(LPDDRAWI_DDRAWSURFACE_INT iface,
|
|
|
|
LPDDRAWI_DDRAWSURFACE_INT pAttach)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
|
|
|
|
// LPDDRAWI_DDRAWSURFACE_INT This = (LPDDRAWI_DDRAWSURFACE_INT)iface;
|
2006-11-19 19:13:35 +00:00
|
|
|
// LPDDRAWI_DDRAWSURFACE_INT That = (LPDDRAWI_DDRAWSURFACE_INT)pAttach;
|
2006-07-25 17:31:07 +00:00
|
|
|
|
2006-11-05 21:19:53 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
DX_STUB;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_GetAttachedSurface(LPDDRAWI_DDRAWSURFACE_INT This,
|
2006-12-14 21:11:00 +00:00
|
|
|
LPDDSCAPS2 pCaps,
|
2007-12-16 14:07:33 +00:00
|
|
|
LPDDRAWI_DDRAWSURFACE_INT* ppSurface)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
2006-12-14 21:11:00 +00:00
|
|
|
/* FIXME hacked */
|
|
|
|
|
|
|
|
|
2006-04-08 15:03:35 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2007-12-16 14:07:33 +00:00
|
|
|
*ppSurface = This->lpLcl->lpGbl->lpDD->dsList;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-12-14 21:11:00 +00:00
|
|
|
|
2006-12-17 13:53:19 +00:00
|
|
|
return DD_OK;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_GetBltStatus(LPDDRAWI_DDRAWSURFACE_INT This, DWORD dwFlags)
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
2006-04-08 15:03:35 +00:00
|
|
|
|
2006-11-05 21:19:53 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2008-12-07 21:48:44 +00:00
|
|
|
if (!(This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.dwFlags & DDHAL_SURFCB32_FLIP))
|
2006-04-08 21:05:49 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
return DDERR_GENERIC;
|
2006-04-08 21:05:49 +00:00
|
|
|
}
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
DX_STUB;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_GetCaps(LPDDRAWI_DDRAWSURFACE_INT This, LPDDSCAPS2 pCaps)
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
2006-04-07 22:18:17 +00:00
|
|
|
|
2006-11-05 21:19:53 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2007-12-16 14:07:33 +00:00
|
|
|
if (This == NULL)
|
2006-04-07 22:18:17 +00:00
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_INVALIDOBJECT;
|
2006-04-07 22:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pCaps == NULL)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_INVALIDPARAMS;
|
2006-04-07 22:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RtlZeroMemory(pCaps,sizeof(DDSCAPS2));
|
2006-11-19 19:13:35 +00:00
|
|
|
|
|
|
|
pCaps->dwCaps = This->lpLcl->ddsCaps.dwCaps;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-04-07 22:18:17 +00:00
|
|
|
return DD_OK;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
2007-06-07 11:49:43 +00:00
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_GetClipper(LPDDRAWI_DDRAWSURFACE_INT This,
|
2007-06-07 11:49:43 +00:00
|
|
|
LPDIRECTDRAWCLIPPER* ppClipper)
|
|
|
|
{
|
|
|
|
|
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
|
|
|
if (This == NULL)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_INVALIDOBJECT;
|
2007-06-07 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ppClipper == NULL)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_INVALIDPARAMS;
|
2007-06-07 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (This->lpLcl->lp16DDClipper == NULL)
|
|
|
|
{
|
|
|
|
return DDERR_NOCLIPPERATTACHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppClipper = (LPDIRECTDRAWCLIPPER)This->lpLcl->lp16DDClipper;
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
return DD_OK;
|
2007-06-07 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_SetClipper (LPDDRAWI_DDRAWSURFACE_INT This,
|
2007-06-07 11:49:43 +00:00
|
|
|
LPDIRECTDRAWCLIPPER pDDClipper)
|
|
|
|
{
|
|
|
|
|
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
|
|
|
if (This == NULL)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_INVALIDOBJECT;
|
2007-06-07 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(pDDClipper == NULL)
|
|
|
|
{
|
|
|
|
if(!This->lpLcl->lp16DDClipper)
|
|
|
|
return DDERR_NOCLIPPERATTACHED;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2007-06-07 11:49:43 +00:00
|
|
|
DirectDrawClipper_Release((LPDIRECTDRAWCLIPPER)This->lpLcl->lp16DDClipper);
|
|
|
|
This->lpLcl->lp16DDClipper = NULL;
|
|
|
|
return DD_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: Check Surface type and return DDERR_INVALIDSURFACETYPE
|
|
|
|
|
|
|
|
DirectDrawClipper_AddRef((LPDIRECTDRAWCLIPPER)pDDClipper);
|
|
|
|
This->lpLcl->lp16DDClipper = (LPDDRAWI_DDRAWCLIPPER_INT)pDDClipper;
|
|
|
|
|
|
|
|
return DD_OK;
|
|
|
|
}
|
|
|
|
|
2005-08-08 13:29:50 +00:00
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_GetDC(LPDDRAWI_DDRAWSURFACE_INT This, HDC *phDC)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
2006-04-08 09:04:42 +00:00
|
|
|
|
2006-11-05 21:19:53 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2007-12-16 14:07:33 +00:00
|
|
|
if (This == NULL)
|
2006-04-08 09:04:42 +00:00
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_INVALIDOBJECT;
|
2006-04-08 09:04:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (phDC == NULL)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_INVALIDPARAMS;
|
2006-04-08 09:04:42 +00:00
|
|
|
}
|
|
|
|
|
2006-04-08 09:38:26 +00:00
|
|
|
|
2007-04-18 19:51:21 +00:00
|
|
|
*phDC = (HDC)This->lpLcl->lpSurfMore->lpDD_lcl->hDC;
|
2006-04-08 09:04:42 +00:00
|
|
|
|
|
|
|
return DD_OK;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_GetPixelFormat(LPDDRAWI_DDRAWSURFACE_INT This,
|
2006-12-14 08:22:17 +00:00
|
|
|
LPDDPIXELFORMAT pDDPixelFormat)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
2006-12-13 23:06:48 +00:00
|
|
|
HRESULT retVale = DDERR_INVALIDPARAMS;
|
|
|
|
|
2006-04-08 15:03:35 +00:00
|
|
|
DX_WINDBG_trace();
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-12-13 23:06:48 +00:00
|
|
|
if (pDDPixelFormat != NULL)
|
|
|
|
{
|
2006-12-14 08:22:17 +00:00
|
|
|
if (This->lpLcl->dwFlags & DDRAWISURF_HASPIXELFORMAT)
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
2006-12-14 08:22:17 +00:00
|
|
|
memcpy(pDDPixelFormat,&This->lpLcl->lpGbl->ddpfSurface,sizeof(DDPIXELFORMAT));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memcpy(pDDPixelFormat,&This->lpLcl->lpSurfMore->
|
2006-12-13 23:06:48 +00:00
|
|
|
lpDD_lcl->lpGbl->vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
|
2006-12-14 08:22:17 +00:00
|
|
|
}
|
2006-12-13 23:06:48 +00:00
|
|
|
retVale = DD_OK;
|
|
|
|
}
|
2006-12-14 08:22:17 +00:00
|
|
|
|
2006-12-13 23:06:48 +00:00
|
|
|
return retVale;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_GetSurfaceDesc(LPDDRAWI_DDRAWSURFACE_INT This,
|
2005-08-08 13:29:50 +00:00
|
|
|
LPDDSURFACEDESC2 pDDSD)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
DWORD dwSize;
|
|
|
|
|
2006-11-05 21:19:53 +00:00
|
|
|
DX_WINDBG_trace();
|
2006-04-09 17:05:57 +00:00
|
|
|
|
|
|
|
dwSize = pDDSD->dwSize;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-04-09 17:05:57 +00:00
|
|
|
if ((dwSize != sizeof(DDSURFACEDESC)) &&
|
2007-10-19 23:21:45 +00:00
|
|
|
(dwSize != sizeof(DDSURFACEDESC2)))
|
|
|
|
{
|
2006-04-09 17:05:57 +00:00
|
|
|
return DDERR_GENERIC;
|
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
ZeroMemory(pDDSD,dwSize);
|
|
|
|
|
|
|
|
if (dwSize == sizeof(DDSURFACEDESC))
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
LPDDSURFACEDESC lpDS = (LPDDSURFACEDESC) pDDSD;
|
2006-11-19 19:13:35 +00:00
|
|
|
memcpy(&lpDS->ddckCKDestBlt, &This->lpLcl->ddckCKDestBlt, sizeof(DDCOLORKEY));
|
|
|
|
memcpy(&lpDS->ddckCKDestOverlay, &This->lpLcl->ddckCKDestOverlay, sizeof(DDCOLORKEY));
|
|
|
|
memcpy(&lpDS->ddckCKSrcBlt, &This->lpLcl->ddckCKSrcBlt, sizeof(DDCOLORKEY));
|
2007-10-19 23:21:45 +00:00
|
|
|
memcpy(&lpDS->ddckCKSrcOverlay, &This->lpLcl->ddckCKSrcOverlay, sizeof(DDCOLORKEY));
|
2006-11-19 19:13:35 +00:00
|
|
|
memcpy(&lpDS->ddpfPixelFormat, &This->lpLcl->lpGbl->ddpfSurface, sizeof(DDPIXELFORMAT));
|
|
|
|
memcpy(&lpDS->ddsCaps, &This->lpLcl->ddsCaps, sizeof(DDSCAPS));
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
lpDS->dwAlphaBitDepth = This->lpLcl->dwAlpha;
|
|
|
|
lpDS->dwBackBufferCount = This->lpLcl->dwBackBufferCount;
|
|
|
|
|
|
|
|
/* FIXME setting the flags right */
|
|
|
|
// lpDS->dwFlags = This->lpLcl->dwFlags;
|
|
|
|
|
|
|
|
lpDS->dwHeight = This->lpLcl->lpGbl->wHeight;
|
|
|
|
lpDS->dwWidth = This->lpLcl->lpGbl->wWidth;
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
/* This two are a union in lpDS and in This->lpLcl->lpGbl
|
|
|
|
so I comment out lPitch
|
2006-11-19 19:13:35 +00:00
|
|
|
lpDS->lPitch = This->lpLcl->lpGbl->lPitch;
|
|
|
|
*/
|
2007-10-19 23:21:45 +00:00
|
|
|
lpDS->dwLinearSize = This->lpLcl->lpGbl->dwLinearSize;
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
|
|
|
|
/* This tree are a union */
|
|
|
|
//lpDS->dwMipMapCount
|
|
|
|
//lpDS->dwRefreshRate
|
|
|
|
//lpDS->dwZBufferBitDepth
|
|
|
|
|
|
|
|
/* Unknown */
|
2007-10-19 23:21:45 +00:00
|
|
|
// lpDS->dwReserved
|
|
|
|
// lpDS->lpSurface
|
2006-11-19 19:13:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memcpy(&pDDSD->ddckCKDestBlt, &This->lpLcl->ddckCKDestBlt, sizeof(DDCOLORKEY));
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
/*
|
|
|
|
pDDSD->dwEmptyFaceColor is a union to ddckCKDestOverlay
|
|
|
|
*/
|
|
|
|
memcpy(&pDDSD->ddckCKDestOverlay, &This->lpLcl->ddckCKDestOverlay, sizeof(DDCOLORKEY));
|
|
|
|
memcpy(&pDDSD->ddckCKSrcBlt, &This->lpLcl->ddckCKSrcBlt, sizeof(DDCOLORKEY));
|
2007-10-19 23:21:45 +00:00
|
|
|
memcpy(&pDDSD->ddckCKSrcOverlay, &This->lpLcl->ddckCKSrcOverlay, sizeof(DDCOLORKEY));
|
2006-11-19 19:13:35 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
pDDSD->dwFVF is a union to ddpfPixelFormat
|
|
|
|
*/
|
|
|
|
memcpy(&pDDSD->ddpfPixelFormat, &This->lpLcl->lpGbl->ddpfSurface, sizeof(DDPIXELFORMAT));
|
|
|
|
memcpy(&pDDSD->ddsCaps, &This->lpLcl->ddsCaps, sizeof(DDSCAPS));
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
|
|
|
|
pDDSD->dwAlphaBitDepth = This->lpLcl->dwAlpha;
|
|
|
|
pDDSD->dwBackBufferCount = This->lpLcl->dwBackBufferCount;
|
|
|
|
|
|
|
|
/* FIXME setting the flags right */
|
|
|
|
// lpDS->dwFlags = This->lpLcl->dwFlags;
|
|
|
|
|
|
|
|
pDDSD->dwHeight = This->lpLcl->lpGbl->wHeight;
|
|
|
|
pDDSD->dwWidth = This->lpLcl->lpGbl->wWidth;
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
/* This two are a union in lpDS and in This->lpLcl->lpGbl
|
|
|
|
so I comment out lPitch
|
2006-11-19 19:13:35 +00:00
|
|
|
lpDS->lPitch = This->lpLcl->lpGbl->lPitch;
|
|
|
|
*/
|
2007-10-19 23:21:45 +00:00
|
|
|
pDDSD->dwLinearSize = This->lpLcl->lpGbl->dwLinearSize;
|
2006-11-19 19:13:35 +00:00
|
|
|
|
|
|
|
/* This tree are a union */
|
|
|
|
// pDDSD->dwMipMapCount
|
2007-10-19 23:21:45 +00:00
|
|
|
// pDDSD->dwRefreshRate
|
2006-11-19 19:13:35 +00:00
|
|
|
// pDDSD->dwSrcVBHandle
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
/* Unknown */
|
2007-10-19 23:21:45 +00:00
|
|
|
// lpDS->dwReserved
|
|
|
|
// lpDS->lpSurface
|
|
|
|
// pDDSD->dwTextureStage
|
2006-11-19 19:13:35 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-04-09 17:05:57 +00:00
|
|
|
return DD_OK;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_ReleaseDC(LPDDRAWI_DDRAWSURFACE_INT This, HDC hDC)
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
2006-11-05 21:19:53 +00:00
|
|
|
DX_WINDBG_trace();
|
2006-04-08 09:38:26 +00:00
|
|
|
|
2007-12-16 14:07:33 +00:00
|
|
|
if (This == NULL)
|
2006-04-08 09:38:26 +00:00
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_INVALIDOBJECT;
|
2006-04-08 09:38:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (hDC == NULL)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_INVALIDPARAMS;
|
2006-04-08 09:38:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME check if surface exits or not */
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
if ((HDC)This->lpLcl->hDC == NULL)
|
2006-04-08 09:38:26 +00:00
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
return DDERR_GENERIC;
|
2006-04-08 09:38:26 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-04-08 09:38:26 +00:00
|
|
|
return DD_OK;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_SetColorKey (LPDDRAWI_DDRAWSURFACE_INT This,
|
2005-08-08 13:29:50 +00:00
|
|
|
DWORD dwFlags, LPDDCOLORKEY pCKey)
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
DDHAL_SETCOLORKEYDATA ColorKeyData;
|
2005-08-08 13:29:50 +00:00
|
|
|
|
2006-11-05 21:19:53 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
ColorKeyData.ddRVal = DDERR_COLORKEYNOTSET;
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
if (This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.dwFlags & DDHAL_SURFCB32_SETCOLORKEY)
|
2006-04-08 21:05:49 +00:00
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
ColorKeyData.lpDD = This->lpLcl->lpGbl->lpDD;
|
|
|
|
ColorKeyData.SetColorKey = This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.SetColorKey;
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
//ColorKeyData.lpDDSurface = &This->lpLcl->hDDSurface;
|
|
|
|
ColorKeyData.dwFlags = dwFlags;
|
|
|
|
/* FIXME
|
|
|
|
ColorKeyData.ckNew = ?
|
2006-11-19 19:13:35 +00:00
|
|
|
add / move dwFlags to This->lpLcl->dwFlags ??
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (ColorKeyData.SetColorKey(&ColorKeyData) == DDHAL_DRIVER_HANDLED )
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
return ColorKeyData.ddRVal;
|
|
|
|
}
|
2006-04-08 21:05:49 +00:00
|
|
|
}
|
2006-11-19 19:13:35 +00:00
|
|
|
return DDERR_COLORKEYNOTSET;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|
|
|
|
|
2006-04-08 21:05:49 +00:00
|
|
|
|
|
|
|
|
2005-08-08 13:29:50 +00:00
|
|
|
HRESULT WINAPI
|
2007-12-16 14:07:33 +00:00
|
|
|
Main_DDrawSurface_SetOverlayPosition (LPDDRAWI_DDRAWSURFACE_INT This, LONG X, LONG Y)
|
2005-08-08 13:29:50 +00:00
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
DDHAL_SETOVERLAYPOSITIONDATA OverLayPositionData;
|
2006-04-08 15:03:35 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
DX_WINDBG_trace();
|
|
|
|
|
|
|
|
OverLayPositionData.ddRVal = DDERR_COLORKEYNOTSET;
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
if (This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.dwFlags & DDHAL_SURFCB32_SETOVERLAYPOSITION)
|
2006-11-19 19:13:35 +00:00
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
OverLayPositionData.lpDD = This->lpLcl->lpGbl->lpDD;
|
|
|
|
OverLayPositionData.SetOverlayPosition = This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.SetOverlayPosition;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-11-19 19:13:35 +00:00
|
|
|
//OverLayPositionData.lpDDSrcSurface = This->lpLcl->lpSurfaceOverlaying->lpLcl->hDDSurface;
|
|
|
|
//OverLayPositionData.lpDDDestSurface = This->lpLcl->hDDSurface;
|
|
|
|
|
|
|
|
OverLayPositionData.lXPos = X;
|
|
|
|
OverLayPositionData.lYPos = Y;
|
|
|
|
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
/* FIXME
|
2006-11-19 19:13:35 +00:00
|
|
|
Should X and Y be save ??
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (OverLayPositionData.SetOverlayPosition(&OverLayPositionData) == DDHAL_DRIVER_HANDLED )
|
2007-10-19 23:21:45 +00:00
|
|
|
{
|
2006-11-19 19:13:35 +00:00
|
|
|
return OverLayPositionData.ddRVal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DDERR_GENERIC;
|
2005-08-08 13:29:50 +00:00
|
|
|
}
|