[PATCH] WineD3D: Basic overlay emulation with opengl=0A=
Stefan Doesinger
stefan at codeweavers.com
Fri Aug 1 13:12:18 CDT 2008
=0A=
This patch implements very basic overlay emulation with opengl.=0A=
So far the overlay surface is blitted onto the overlayed surface=0A=
and updated if the position or content changes. The overlay caps=0A=
aren't set yet because the following things are missing:=0A=
=0A=
* Overlay flipping=0A=
=0A=
* If the application draws over the area where the overlay is,=0A=
the overlay is overdrawn. ModifyLocation will have to redraw the=0A=
overlay if the overlayed surface's DRAWABLE location is modified.=0A=
To prevent GDI overwrites we will need a clip rectangle=0A=
=0A=
* D3DFMT_UYVY, YUY2, YV12 support=0A=
---=0A=
dlls/wined3d/surface.c | 23 ++++++++++++++++++++++-=0A=
dlls/wined3d/surface_base.c | 6 +++++-=0A=
dlls/wined3d/surface_gdi.c | 8 +++++++-=0A=
include/wine/wined3d_interface.h | 2 ++=0A=
4 files changed, 36 insertions(+), 3 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c=0A=
index b15e2a0..42ce5d1 100644=0A=
--- a/dlls/wined3d/surface.c=0A=
+++ b/dlls/wined3d/surface.c=0A=
@@ -1378,6 +1378,11 @@ static HRESULT WINAPI =
IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {=0A=
unlock_end:=0A=
This->Flags &=3D ~SFLAG_LOCKED;=0A=
memset(&This->lockedRect, 0, sizeof(RECT));=0A=
+=0A=
+ /* Overlays have to be redrawn manually after changes with the GL =
implementation */=0A=
+ if(This->overlay_dest) {=0A=
+ IWineD3DSurface_DrawOverlay(iface);=0A=
+ }=0A=
return WINED3D_OK;=0A=
}=0A=
=0A=
@@ -3338,6 +3343,7 @@ static HRESULT =
IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *=0A=
=0A=
=0A=
/* Activate the destination context, set it up for blitting */=0A=
+ myDevice->activeContext->last_was_blit =3D FALSE;=0A=
ActivateContext(myDevice, (IWineD3DSurface *) This, =
CTXUSAGE_BLIT);=0A=
=0A=
if(!dstSwapchain) {=0A=
@@ -4452,6 +4458,20 @@ static WINED3DSURFTYPE WINAPI =
IWineD3DSurfaceImpl_GetImplType(IWineD3DSurface *i=0A=
return SURFACE_OPENGL;=0A=
}=0A=
=0A=
+static HRESULT WINAPI IWineD3DSurfaceImpl_DrawOverlay(IWineD3DSurface =
*iface) {=0A=
+ IWineD3DSurfaceImpl *This =3D (IWineD3DSurfaceImpl *) iface;=0A=
+ HRESULT hr;=0A=
+=0A=
+ /* If there's no destination surface there is nothing to do */=0A=
+ if(!This->overlay_dest) return WINED3D_OK;=0A=
+=0A=
+ hr =3D IWineD3DSurfaceImpl_Blt((IWineD3DSurface *) =
This->overlay_dest, &This->overlay_destrect,=0A=
+ iface, &This->overlay_srcrect, =
WINEDDBLT_WAIT,=0A=
+ NULL, WINED3DTEXF_LINEAR);=0A=
+=0A=
+ return hr;=0A=
+}=0A=
+=0A=
const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =3D=0A=
{=0A=
/* IUnknown */=0A=
@@ -4508,5 +4528,6 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =3D=0A=
IWineD3DSurfaceImpl_PrivateSetup,=0A=
IWineD3DSurfaceImpl_ModifyLocation,=0A=
IWineD3DSurfaceImpl_LoadLocation,=0A=
- IWineD3DSurfaceImpl_GetImplType=0A=
+ IWineD3DSurfaceImpl_GetImplType,=0A=
+ IWineD3DSurfaceImpl_DrawOverlay=0A=
};=0A=
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c=0A=
index 1302067..3fd55a8 100644=0A=
--- a/dlls/wined3d/surface_base.c=0A=
+++ b/dlls/wined3d/surface_base.c=0A=
@@ -374,6 +374,8 @@ HRESULT WINAPI =
IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface=0A=
This->overlay_destrect.right =3D X + w;=0A=
This->overlay_destrect.bottom =3D Y + h;=0A=
=0A=
+ IWineD3DSurface_DrawOverlay(iface);=0A=
+=0A=
return WINED3D_OK;=0A=
}=0A=
=0A=
@@ -419,7 +421,7 @@ HRESULT WINAPI =
IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *ifac=0A=
HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface =
*iface, RECT *SrcRect, IWineD3DSurface *DstSurface, RECT *DstRect, DWORD =
Flags, WINEDDOVERLAYFX *FX) {=0A=
IWineD3DSurfaceImpl *This =3D (IWineD3DSurfaceImpl *) iface;=0A=
IWineD3DSurfaceImpl *Dst =3D (IWineD3DSurfaceImpl *) DstSurface;=0A=
- FIXME("(%p)->(%p, %p, %p, %08x, %p)\n", This, SrcRect, Dst, =
DstRect, Flags, FX);=0A=
+ TRACE("(%p)->(%p, %p, %p, %08x, %p)\n", This, SrcRect, Dst, =
DstRect, Flags, FX);=0A=
=0A=
if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))=0A=
{=0A=
@@ -460,6 +462,8 @@ HRESULT WINAPI =
IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, REC=0A=
This->overlay_dest =3D NULL;=0A=
}=0A=
=0A=
+ IWineD3DSurface_DrawOverlay(iface);=0A=
+=0A=
return WINED3D_OK;=0A=
}=0A=
=0A=
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c=0A=
index 030b848..60564b4 100644=0A=
--- a/dlls/wined3d/surface_gdi.c=0A=
+++ b/dlls/wined3d/surface_gdi.c=0A=
@@ -801,6 +801,11 @@ static WINED3DSURFTYPE WINAPI =
IWineGDISurfaceImpl_GetImplType(IWineD3DSurface *i=0A=
return SURFACE_GDI;=0A=
}=0A=
=0A=
+static HRESULT WINAPI IWineGDISurfaceImpl_DrawOverlay(IWineD3DSurface =
*iface) {=0A=
+ FIXME("GDI surfaces can't draw overlays yet\n");=0A=
+ return E_FAIL;=0A=
+}=0A=
+=0A=
/* FIXME: This vtable should not use any IWineD3DSurface* =
implementation functions,=0A=
* only IWineD3DBaseSurface and IWineGDISurface ones.=0A=
*/=0A=
@@ -860,5 +865,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =3D=0A=
IWineGDISurfaceImpl_PrivateSetup,=0A=
IWineGDISurfaceImpl_ModifyLocation,=0A=
IWineGDISurfaceImpl_LoadLocation,=0A=
- IWineGDISurfaceImpl_GetImplType=0A=
+ IWineGDISurfaceImpl_GetImplType,=0A=
+ IWineGDISurfaceImpl_DrawOverlay=0A=
};=0A=
diff --git a/include/wine/wined3d_interface.h =
b/include/wine/wined3d_interface.h=0A=
index 05bc49a..aa2c599 100644=0A=
--- a/include/wine/wined3d_interface.h=0A=
+++ b/include/wine/wined3d_interface.h=0A=
@@ -1175,6 +1175,7 @@ =
DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)=0A=
STDMETHOD_(void,ModifyLocation)(THIS_ DWORD flag, BOOL persistent);=0A=
STDMETHOD(LoadLocation)(THIS_ DWORD flag, const RECT *rect);=0A=
STDMETHOD_(WINED3DSURFTYPE,GetImplType)(THIS);=0A=
+ STDMETHOD(DrawOverlay)(THIS);=0A=
};=0A=
#undef INTERFACE=0A=
=0A=
@@ -1235,6 +1236,7 @@ =
DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)=0A=
#define IWineD3DSurface_ModifyLocation(p,a,b) =
(p)->lpVtbl->ModifyLocation(p,a,b)=0A=
#define IWineD3DSurface_LoadLocation(p,a,b) =
(p)->lpVtbl->LoadLocation(p,a,b)=0A=
#define IWineD3DSurface_GetImplType(p) =
(p)->lpVtbl->GetImplType(p)=0A=
+#define IWineD3DSurface_DrawOverlay(p) =
(p)->lpVtbl->DrawOverlay(p)=0A=
#endif=0A=
=0A=
=
/************************************************************************=
*****=0A=
-- =0A=
1.5.4.5=0A=
=0A=
------=_NextPart_000_002D_01C8F640.918A29F0--
More information about the wine-patches
mailing list