From dff3a422338b839876b305c288c5fbb654d656d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 30 Jul 2008 15:28:25 -0500 Subject: [PATCH] wined3d: Track overlay surfaces in the overlayed surface. --- dlls/wined3d/device.c | 1 + dlls/wined3d/surface.c | 4 ++++ dlls/wined3d/surface_base.c | 10 ++++++++-- dlls/wined3d/surface_gdi.c | 4 ++++ dlls/wined3d/wined3d_private.h | 2 ++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index dab4b38b50e..49a72eb169b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -660,6 +660,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U object->currentDesc.MultiSampleType = MultiSample; object->currentDesc.MultiSampleQuality = MultisampleQuality; object->glDescription.level = Level; + list_init(&object->overlays); /* Flags */ object->Flags = SFLAG_NORMCOORD; /* Default to normalized coords */ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 1ea221ce268..07c7076bd7f 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -474,6 +474,10 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) { if(iface == device->ddraw_primary) device->ddraw_primary = NULL; + if(This->overlay_dest) { + list_remove(&This->overlay_entry); + } + TRACE("(%p) Released\n", This); HeapFree(GetProcessHeap(), 0, This); diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c index 381632988bc..bace47616e9 100644 --- a/dlls/wined3d/surface_base.c +++ b/dlls/wined3d/surface_base.c @@ -450,9 +450,15 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, REC This->overlay_destrect.bottom = Dst ? Dst->currentDesc.Height : 0; } - if(Flags & WINEDDOVER_SHOW) { - This->overlay_dest = Dst; + if(This->overlay_dest && (This->overlay_dest != Dst || Flags & WINEDDOVER_HIDE)) { + list_remove(&This->overlay_entry); + } + if(Flags & WINEDDOVER_SHOW) { + if(This->overlay_dest != Dst) { + This->overlay_dest = Dst; + list_add_tail(&Dst->overlays, &This->overlay_entry); + } } else if(Flags & WINEDDOVER_HIDE) { /* tests show that the rectangles are erased on hide */ This->overlay_srcrect.left = 0; This->overlay_srcrect.top = 0; diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c index 60564b435e1..1b1e5dbeb7d 100644 --- a/dlls/wined3d/surface_gdi.c +++ b/dlls/wined3d/surface_gdi.c @@ -160,6 +160,10 @@ ULONG WINAPI IWineGDISurfaceImpl_Release(IWineD3DSurface *iface) { if(iface == device->ddraw_primary) device->ddraw_primary = NULL; + if(This->overlay_dest) { + list_remove(&This->overlay_entry); + } + TRACE("(%p) Released\n", This); HeapFree(GetProcessHeap(), 0, This); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 669e8654b0d..91617e8ec0b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1331,6 +1331,8 @@ struct IWineD3DSurfaceImpl RECT overlay_srcrect; RECT overlay_destrect; IWineD3DSurfaceImpl *overlay_dest; + struct list overlays; + struct list overlay_entry; }; extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;