[PATCH] WineD3D: Update the overlay when the destination was =

Stefan Doesinger stefan at codeweavers.com
Wed Aug 20 10:48:14 CDT 2008


drawn to=0A=
=0A=
---=0A=
 dlls/wined3d/surface.c         |   16 ++++++++++++++++=0A=
 dlls/wined3d/wined3d_private.h |    1 +=0A=
 2 files changed, 17 insertions(+), 0 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c=0A=
index 9a50e84..3ef659f 100644=0A=
--- a/dlls/wined3d/surface.c=0A=
+++ b/dlls/wined3d/surface.c=0A=
@@ -4077,6 +4077,7 @@ void surface_load_ds_location(IWineD3DSurface =
*iface, DWORD location) {=0A=
 static void WINAPI IWineD3DSurfaceImpl_ModifyLocation(IWineD3DSurface =
*iface, DWORD flag, BOOL persistent) {=0A=
     IWineD3DSurfaceImpl *This =3D (IWineD3DSurfaceImpl *) iface;=0A=
     IWineD3DBaseTexture *texture;=0A=
+    IWineD3DSurfaceImpl *overlay;=0A=
 =0A=
     TRACE("(%p)->(%s, %s)\n", iface,=0A=
           flag =3D=3D SFLAG_INSYSMEM ? "SFLAG_INSYSMEM" : flag =3D=3D =
SFLAG_INDRAWABLE ? "SFLAG_INDRAWABLE" : "SFLAG_INTEXTURE",=0A=
@@ -4105,6 +4106,13 @@ static void WINAPI =
IWineD3DSurfaceImpl_ModifyLocation(IWineD3DSurface *iface, DW=0A=
         }=0A=
         This->Flags &=3D ~SFLAG_LOCATIONS;=0A=
         This->Flags |=3D flag;=0A=
+=0A=
+        /* Redraw emulated overlays, if any */=0A=
+        if(flag & SFLAG_INDRAWABLE && !list_empty(&This->overlays)) {=0A=
+            LIST_FOR_EACH_ENTRY(overlay, &This->overlays, =
IWineD3DSurfaceImpl, overlay_entry) {=0A=
+                IWineD3DSurface_DrawOverlay((IWineD3DSurface *) =
overlay);=0A=
+            }=0A=
+        }=0A=
     } else {=0A=
         if((This->Flags & SFLAG_INTEXTURE) && (flag & SFLAG_INTEXTURE)) =
{=0A=
             if (IWineD3DSurface_GetContainer(iface, =
&IID_IWineD3DBaseTexture, (void **)&texture) =3D=3D WINED3D_OK) {=0A=
@@ -4556,9 +4564,17 @@ static HRESULT WINAPI =
IWineD3DSurfaceImpl_DrawOverlay(IWineD3DSurface *iface) {=0A=
     /* If there's no destination surface there is nothing to do */=0A=
     if(!This->overlay_dest) return WINED3D_OK;=0A=
 =0A=
+    /* Blt calls ModifyLocation on the dest surface, which in turn =
calls DrawOverlay to=0A=
+     * update the overlay. Prevent an endless recursion=0A=
+     */=0A=
+    if(This->overlay_dest->Flags & SFLAG_INOVERLAYDRAW) {=0A=
+        return WINED3D_OK;=0A=
+    }=0A=
+    This->overlay_dest->Flags |=3D SFLAG_INOVERLAYDRAW;=0A=
     hr =3D IWineD3DSurfaceImpl_Blt((IWineD3DSurface *) =
This->overlay_dest, &This->overlay_destrect,=0A=
                                  iface, &This->overlay_srcrect, =
WINEDDBLT_WAIT,=0A=
                                  NULL, WINED3DTEXF_LINEAR);=0A=
+    This->overlay_dest->Flags &=3D ~SFLAG_INOVERLAYDRAW;=0A=
 =0A=
     return hr;=0A=
 }=0A=
diff --git a/dlls/wined3d/wined3d_private.h =
b/dlls/wined3d/wined3d_private.h=0A=
index e2b1215..45d8ace 100644=0A=
--- a/dlls/wined3d/wined3d_private.h=0A=
+++ b/dlls/wined3d/wined3d_private.h=0A=
@@ -1423,6 +1423,7 @@ void flip_surface(IWineD3DSurfaceImpl *front, =
IWineD3DSurfaceImpl *back);=0A=
 #define SFLAG_NORMCOORD     0x00080000 /* Set if the GL texture coords =
are normalized(non-texture rectangle) */=0A=
 #define SFLAG_DS_ONSCREEN   0x00100000 /* Is a depth stencil, last =
modified onscreen */=0A=
 #define SFLAG_DS_OFFSCREEN  0x00200000 /* Is a depth stencil, last =
modified offscreen */=0A=
+#define SFLAG_INOVERLAYDRAW 0x00400000 /* Overlay drawing is in =
progress. Recursion prevention */=0A=
 =0A=
 /* In some conditions the surface memory must not be freed:=0A=
  * SFLAG_OVERSIZE: Not all data can be kept in GL=0A=
-- =0A=
1.5.4.5=0A=
=0A=

------=_NextPart_000_006D_01C902BC.AE78A860--




More information about the wine-patches mailing list