Stefan Dösinger : wined3d: Basic overlay emulation with opengl.

Alexandre Julliard julliard at winehq.org
Tue Aug 5 07:26:40 CDT 2008


Module: wine
Branch: master
Commit: fad3f9ba98bcf7931fac442d493071e4d5e1c332
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fad3f9ba98bcf7931fac442d493071e4d5e1c332

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri Aug  1 13:12:18 2008 -0500

wined3d: Basic overlay emulation with opengl.

---

 dlls/wined3d/surface.c           |   23 ++++++++++++++++++++++-
 dlls/wined3d/surface_base.c      |    6 +++++-
 dlls/wined3d/surface_gdi.c       |    8 +++++++-
 include/wine/wined3d_interface.h |    2 ++
 4 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index b15e2a0..42ce5d1 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1378,6 +1378,11 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
     unlock_end:
     This->Flags &= ~SFLAG_LOCKED;
     memset(&This->lockedRect, 0, sizeof(RECT));
+
+    /* Overlays have to be redrawn manually after changes with the GL implementation */
+    if(This->overlay_dest) {
+        IWineD3DSurface_DrawOverlay(iface);
+    }
     return WINED3D_OK;
 }
 
@@ -3338,6 +3343,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
 
 
         /* Activate the destination context, set it up for blitting */
+        myDevice->activeContext->last_was_blit = FALSE;
         ActivateContext(myDevice, (IWineD3DSurface *) This, CTXUSAGE_BLIT);
 
         if(!dstSwapchain) {
@@ -4452,6 +4458,20 @@ static WINED3DSURFTYPE WINAPI IWineD3DSurfaceImpl_GetImplType(IWineD3DSurface *i
     return SURFACE_OPENGL;
 }
 
+static HRESULT WINAPI IWineD3DSurfaceImpl_DrawOverlay(IWineD3DSurface *iface) {
+    IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
+    HRESULT hr;
+
+    /* If there's no destination surface there is nothing to do */
+    if(!This->overlay_dest) return WINED3D_OK;
+
+    hr = IWineD3DSurfaceImpl_Blt((IWineD3DSurface *) This->overlay_dest, &This->overlay_destrect,
+                                 iface, &This->overlay_srcrect, WINEDDBLT_WAIT,
+                                 NULL, WINED3DTEXF_LINEAR);
+
+    return hr;
+}
+
 const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
 {
     /* IUnknown */
@@ -4508,5 +4528,6 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
     IWineD3DSurfaceImpl_PrivateSetup,
     IWineD3DSurfaceImpl_ModifyLocation,
     IWineD3DSurfaceImpl_LoadLocation,
-    IWineD3DSurfaceImpl_GetImplType
+    IWineD3DSurfaceImpl_GetImplType,
+    IWineD3DSurfaceImpl_DrawOverlay
 };
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 59d0958..3816329 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -374,6 +374,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface
     This->overlay_destrect.right = X + w;
     This->overlay_destrect.bottom = Y + h;
 
+    IWineD3DSurface_DrawOverlay(iface);
+
     return WINED3D_OK;
 }
 
@@ -419,7 +421,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *ifac
 HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, RECT *SrcRect, IWineD3DSurface *DstSurface, RECT *DstRect, DWORD Flags, WINEDDOVERLAYFX *FX) {
     IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
     IWineD3DSurfaceImpl *Dst = (IWineD3DSurfaceImpl *) DstSurface;
-    FIXME("(%p)->(%p, %p, %p, %08x, %p)\n", This, SrcRect, Dst, DstRect, Flags, FX);
+    TRACE("(%p)->(%p, %p, %p, %08x, %p)\n", This, SrcRect, Dst, DstRect, Flags, FX);
 
     if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))
     {
@@ -460,6 +462,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, REC
         This->overlay_dest = NULL;
     }
 
+    IWineD3DSurface_DrawOverlay(iface);
+
     return WINED3D_OK;
 }
 
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index 030b848..60564b4 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -801,6 +801,11 @@ static WINED3DSURFTYPE WINAPI IWineGDISurfaceImpl_GetImplType(IWineD3DSurface *i
     return SURFACE_GDI;
 }
 
+static HRESULT WINAPI IWineGDISurfaceImpl_DrawOverlay(IWineD3DSurface *iface) {
+    FIXME("GDI surfaces can't draw overlays yet\n");
+    return E_FAIL;
+}
+
 /* FIXME: This vtable should not use any IWineD3DSurface* implementation functions,
  * only IWineD3DBaseSurface and IWineGDISurface ones.
  */
@@ -860,5 +865,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
     IWineGDISurfaceImpl_PrivateSetup,
     IWineGDISurfaceImpl_ModifyLocation,
     IWineGDISurfaceImpl_LoadLocation,
-    IWineGDISurfaceImpl_GetImplType
+    IWineGDISurfaceImpl_GetImplType,
+    IWineGDISurfaceImpl_DrawOverlay
 };
diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h
index a99a37c..b478cda 100644
--- a/include/wine/wined3d_interface.h
+++ b/include/wine/wined3d_interface.h
@@ -1175,6 +1175,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
     STDMETHOD_(void,ModifyLocation)(THIS_ DWORD flag, BOOL persistent);
     STDMETHOD(LoadLocation)(THIS_ DWORD flag, const RECT *rect);
     STDMETHOD_(WINED3DSURFTYPE,GetImplType)(THIS);
+    STDMETHOD(DrawOverlay)(THIS);
 };
 #undef INTERFACE
 
@@ -1235,6 +1236,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
 #define IWineD3DSurface_ModifyLocation(p,a,b)        (p)->lpVtbl->ModifyLocation(p,a,b)
 #define IWineD3DSurface_LoadLocation(p,a,b)          (p)->lpVtbl->LoadLocation(p,a,b)
 #define IWineD3DSurface_GetImplType(p)               (p)->lpVtbl->GetImplType(p)
+#define IWineD3DSurface_DrawOverlay(p)               (p)->lpVtbl->DrawOverlay(p)
 #endif
 
 /*****************************************************************************




More information about the wine-cvs mailing list