wined3d: Update the overlay when the destination was drawn to.

This commit is contained in:
Stefan Dösinger 2008-08-20 10:48:14 -05:00 committed by Alexandre Julliard
parent 2972775b20
commit bab367e1a0
2 changed files with 17 additions and 0 deletions

View File

@ -4077,6 +4077,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, DWORD location) {
static void WINAPI IWineD3DSurfaceImpl_ModifyLocation(IWineD3DSurface *iface, DWORD flag, BOOL persistent) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
IWineD3DBaseTexture *texture;
IWineD3DSurfaceImpl *overlay;
TRACE("(%p)->(%s, %s)\n", iface,
flag == SFLAG_INSYSMEM ? "SFLAG_INSYSMEM" : flag == SFLAG_INDRAWABLE ? "SFLAG_INDRAWABLE" : "SFLAG_INTEXTURE",
@ -4105,6 +4106,13 @@ static void WINAPI IWineD3DSurfaceImpl_ModifyLocation(IWineD3DSurface *iface, DW
}
This->Flags &= ~SFLAG_LOCATIONS;
This->Flags |= flag;
/* Redraw emulated overlays, if any */
if(flag & SFLAG_INDRAWABLE && !list_empty(&This->overlays)) {
LIST_FOR_EACH_ENTRY(overlay, &This->overlays, IWineD3DSurfaceImpl, overlay_entry) {
IWineD3DSurface_DrawOverlay((IWineD3DSurface *) overlay);
}
}
} else {
if((This->Flags & SFLAG_INTEXTURE) && (flag & SFLAG_INTEXTURE)) {
if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&texture) == WINED3D_OK) {
@ -4556,9 +4564,17 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_DrawOverlay(IWineD3DSurface *iface) {
/* If there's no destination surface there is nothing to do */
if(!This->overlay_dest) return WINED3D_OK;
/* Blt calls ModifyLocation on the dest surface, which in turn calls DrawOverlay to
* update the overlay. Prevent an endless recursion
*/
if(This->overlay_dest->Flags & SFLAG_INOVERLAYDRAW) {
return WINED3D_OK;
}
This->overlay_dest->Flags |= SFLAG_INOVERLAYDRAW;
hr = IWineD3DSurfaceImpl_Blt((IWineD3DSurface *) This->overlay_dest, &This->overlay_destrect,
iface, &This->overlay_srcrect, WINEDDBLT_WAIT,
NULL, WINED3DTEXF_LINEAR);
This->overlay_dest->Flags &= ~SFLAG_INOVERLAYDRAW;
return hr;
}

View File

@ -1423,6 +1423,7 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back);
#define SFLAG_NORMCOORD 0x00080000 /* Set if the GL texture coords are normalized(non-texture rectangle) */
#define SFLAG_DS_ONSCREEN 0x00100000 /* Is a depth stencil, last modified onscreen */
#define SFLAG_DS_OFFSCREEN 0x00200000 /* Is a depth stencil, last modified offscreen */
#define SFLAG_INOVERLAYDRAW 0x00400000 /* Overlay drawing is in progress. Recursion prevention */
/* In some conditions the surface memory must not be freed:
* SFLAG_OVERSIZE: Not all data can be kept in GL