wined3d: Implement overlay position tracking.

This commit is contained in:
Stefan Dösinger 2008-08-05 12:19:43 +02:00 committed by Alexandre Julliard
parent a7d5b1e9a5
commit e795d842ec
5 changed files with 92 additions and 5 deletions

View File

@ -1841,7 +1841,13 @@ IDirectDrawSurfaceImpl_UpdateOverlay(IDirectDrawSurface7 *iface,
Flags,
(WINEDDOVERLAYFX *) FX);
LeaveCriticalSection(&ddraw_cs);
return hr;
switch(hr) {
case WINED3DERR_INVALIDCALL: return DDERR_INVALIDPARAMS;
case WINEDDERR_NOTAOVERLAYSURFACE: return DDERR_NOTAOVERLAYSURFACE;
case WINEDDERR_OVERLAYNOTVISIBLE: return DDERR_OVERLAYNOTVISIBLE;
default:
return hr;
}
}
/*****************************************************************************

View File

@ -357,8 +357,9 @@ DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) {
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface, LONG X, LONG Y) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
LONG w, h;
FIXME("(%p)->(%d,%d) Stub!\n", This, X, Y);
TRACE("(%p)->(%d,%d) Stub!\n", This, X, Y);
if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))
{
@ -366,21 +367,38 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface
return WINEDDERR_NOTAOVERLAYSURFACE;
}
w = This->overlay_destrect.right - This->overlay_destrect.left;
h = This->overlay_destrect.bottom - This->overlay_destrect.top;
This->overlay_destrect.left = X;
This->overlay_destrect.top = Y;
This->overlay_destrect.right = X + w;
This->overlay_destrect.bottom = Y + h;
return WINED3D_OK;
}
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface *iface, LONG *X, LONG *Y) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
HRESULT hr;
FIXME("(%p)->(%p,%p) Stub!\n", This, X, Y);
TRACE("(%p)->(%p,%p)\n", This, X, Y);
if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))
{
TRACE("(%p): Not an overlay surface\n", This);
return WINEDDERR_NOTAOVERLAYSURFACE;
}
if(This->overlay_dest == NULL) {
*X = 0; *Y = 0;
hr = WINEDDERR_OVERLAYNOTVISIBLE;
} else {
*X = This->overlay_destrect.left;
*Y = This->overlay_destrect.top;
hr = WINED3D_OK;
}
return WINED3D_OK;
TRACE("Returning 0x%08x, position %d, %d\n", hr, *X, *Y);
return hr;
}
HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *iface, DWORD Flags, IWineD3DSurface *Ref) {
@ -405,8 +423,41 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, REC
if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))
{
TRACE("(%p): Not an overlay surface\n", This);
WARN("(%p): Not an overlay surface\n", This);
return WINEDDERR_NOTAOVERLAYSURFACE;
} else if(!DstSurface) {
WARN("(%p): Dest surface is NULL\n", This);
return WINED3DERR_INVALIDCALL;
}
if(SrcRect) {
This->overlay_srcrect = *SrcRect;
} else {
This->overlay_srcrect.left = 0;
This->overlay_srcrect.top = 0;
This->overlay_srcrect.right = This->currentDesc.Width;
This->overlay_srcrect.bottom = This->currentDesc.Height;
}
if(DstRect) {
This->overlay_destrect = *DstRect;
} else {
This->overlay_destrect.left = 0;
This->overlay_destrect.top = 0;
This->overlay_destrect.right = Dst ? Dst->currentDesc.Width : 0;
This->overlay_destrect.bottom = Dst ? Dst->currentDesc.Height : 0;
}
if(Flags & WINEDDOVER_SHOW) {
This->overlay_dest = Dst;
} else if(Flags & WINEDDOVER_HIDE) {
/* tests show that the rectangles are erased on hide */
This->overlay_srcrect.left = 0; This->overlay_srcrect.top = 0;
This->overlay_srcrect.right = 0; This->overlay_srcrect.bottom = 0;
This->overlay_destrect.left = 0; This->overlay_destrect.top = 0;
This->overlay_destrect.right = 0; This->overlay_destrect.bottom = 0;
This->overlay_dest = NULL;
}
return WINED3D_OK;

View File

@ -1326,6 +1326,11 @@ struct IWineD3DSurfaceImpl
/* DirectDraw clippers */
IWineD3DClipper *clipper;
/* DirectDraw Overlay handling */
RECT overlay_srcrect;
RECT overlay_destrect;
IWineD3DSurfaceImpl *overlay_dest;
};
extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;

View File

@ -80,6 +80,7 @@ struct IWineD3DSurface;
#define WINEDDERR_SURFACEBUSY MAKE_WINED3DHRESULT(430)
#define WINEDDERR_INVALIDRECT MAKE_WINED3DHRESULT(150)
#define WINEDDERR_NOCLIPLIST MAKE_WINED3DHRESULT(205)
#define WINEDDERR_OVERLAYNOTVISIBLE MAKE_WINED3DHRESULT(577)
#define WINED3DOK_NOAUTOGEN MAKE_WINED3DSTATUS(2159)
/*****************************************************************************

View File

@ -1803,4 +1803,28 @@ typedef struct _WINEDDOVERLAYFX
#define WINEDDFLIP_INTERVAL3 0x03000000
#define WINEDDFLIP_INTERVAL4 0x04000000
#define WINEDDOVER_ALPHADEST 0x00000001
#define WINEDDOVER_ALPHADESTCONSTOVERRIDE 0x00000002
#define WINEDDOVER_ALPHADESTNEG 0x00000004
#define WINEDDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008
#define WINEDDOVER_ALPHAEDGEBLEND 0x00000010
#define WINEDDOVER_ALPHASRC 0x00000020
#define WINEDDOVER_ALPHASRCCONSTOVERRIDE 0x00000040
#define WINEDDOVER_ALPHASRCNEG 0x00000080
#define WINEDDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100
#define WINEDDOVER_HIDE 0x00000200
#define WINEDDOVER_KEYDEST 0x00000400
#define WINEDDOVER_KEYDESTOVERRIDE 0x00000800
#define WINEDDOVER_KEYSRC 0x00001000
#define WINEDDOVER_KEYSRCOVERRIDE 0x00002000
#define WINEDDOVER_SHOW 0x00004000
#define WINEDDOVER_ADDDIRTYRECT 0x00008000
#define WINEDDOVER_REFRESHDIRTYRECTS 0x00010000
#define WINEDDOVER_REFRESHALL 0x00020000
#define WINEDDOVER_DDFX 0x00080000
#define WINEDDOVER_AUTOFLIP 0x00100000
#define WINEDDOVER_BOB 0x00200000
#define WINEDDOVER_OVERRIDEBOBWEAVE 0x00400000
#define WINEDDOVER_INTERLEAVED 0x00800000
#endif