[PATCH] WineD3D: Implement overlay position tracking=0A=

Stefan Doesinger stefan at codeweavers.com
Wed Jul 30 15:19:14 CDT 2008


=0A=
---=0A=
 dlls/ddraw/surface.c             |    8 ++++-=0A=
 dlls/wined3d/surface_base.c      |   59 =
+++++++++++++++++++++++++++++++++++--=0A=
 dlls/wined3d/wined3d_private.h   |    5 +++=0A=
 include/wine/wined3d_interface.h |    1 +=0A=
 include/wine/wined3d_types.h     |   24 +++++++++++++++=0A=
 5 files changed, 92 insertions(+), 5 deletions(-)=0A=
=0A=
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c=0A=
index a716149..bc25218 100644=0A=
--- a/dlls/ddraw/surface.c=0A=
+++ b/dlls/ddraw/surface.c=0A=
@@ -1841,7 +1841,13 @@ =
IDirectDrawSurfaceImpl_UpdateOverlay(IDirectDrawSurface7 *iface,=0A=
                                        Flags,=0A=
                                        (WINEDDOVERLAYFX *) FX);=0A=
     LeaveCriticalSection(&ddraw_cs);=0A=
-    return hr;=0A=
+    switch(hr) {=0A=
+        case WINED3DERR_INVALIDCALL:        return DDERR_INVALIDPARAMS;=0A=
+        case WINEDDERR_NOTAOVERLAYSURFACE:  return =
DDERR_NOTAOVERLAYSURFACE;=0A=
+        case WINEDDERR_OVERLAYNOTVISIBLE:   return =
DDERR_OVERLAYNOTVISIBLE;=0A=
+        default:=0A=
+            return hr;=0A=
+    }=0A=
 }=0A=
 =0A=
 =
/************************************************************************=
*****=0A=
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c=0A=
index 400c7a7..1302067 100644=0A=
--- a/dlls/wined3d/surface_base.c=0A=
+++ b/dlls/wined3d/surface_base.c=0A=
@@ -357,8 +357,9 @@ DWORD WINAPI =
IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) {=0A=
 =0A=
 HRESULT WINAPI =
IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface, LONG =
X, LONG Y) {=0A=
     IWineD3DSurfaceImpl *This =3D (IWineD3DSurfaceImpl *) iface;=0A=
+    long w, h;=0A=
 =0A=
-    FIXME("(%p)->(%d,%d) Stub!\n", This, X, Y);=0A=
+    TRACE("(%p)->(%d,%d) Stub!\n", This, X, Y);=0A=
 =0A=
     if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))=0A=
     {=0A=
@@ -366,21 +367,38 @@ HRESULT WINAPI =
IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface=0A=
         return WINEDDERR_NOTAOVERLAYSURFACE;=0A=
     }=0A=
 =0A=
+    w =3D This->overlay_destrect.right - This->overlay_destrect.left;=0A=
+    h =3D This->overlay_destrect.bottom - This->overlay_destrect.top;=0A=
+    This->overlay_destrect.left =3D X;=0A=
+    This->overlay_destrect.top =3D Y;=0A=
+    This->overlay_destrect.right =3D X + w;=0A=
+    This->overlay_destrect.bottom =3D Y + h;=0A=
+=0A=
     return WINED3D_OK;=0A=
 }=0A=
 =0A=
 HRESULT WINAPI =
IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface *iface, LONG =
*X, LONG *Y) {=0A=
     IWineD3DSurfaceImpl *This =3D (IWineD3DSurfaceImpl *) iface;=0A=
+    HRESULT hr;=0A=
 =0A=
-    FIXME("(%p)->(%p,%p) Stub!\n", This, X, Y);=0A=
+    TRACE("(%p)->(%p,%p)\n", This, X, Y);=0A=
 =0A=
     if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))=0A=
     {=0A=
         TRACE("(%p): Not an overlay surface\n", This);=0A=
         return WINEDDERR_NOTAOVERLAYSURFACE;=0A=
     }=0A=
+    if(This->overlay_dest =3D=3D NULL) {=0A=
+        *X =3D 0; *Y =3D 0;=0A=
+        hr =3D WINEDDERR_OVERLAYNOTVISIBLE;=0A=
+    } else {=0A=
+        *X =3D This->overlay_destrect.left;=0A=
+        *Y =3D This->overlay_destrect.top;=0A=
+        hr =3D WINED3D_OK;=0A=
+    }=0A=
 =0A=
-    return WINED3D_OK;=0A=
+    TRACE("Returning 0x%08x, position %d, %d\n", hr, *X, *Y);=0A=
+    return hr;=0A=
 }=0A=
 =0A=
 HRESULT WINAPI =
IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *iface, =
DWORD Flags, IWineD3DSurface *Ref) {=0A=
@@ -405,8 +423,41 @@ HRESULT WINAPI =
IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, REC=0A=
 =0A=
     if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))=0A=
     {=0A=
-        TRACE("(%p): Not an overlay surface\n", This);=0A=
+        WARN("(%p): Not an overlay surface\n", This);=0A=
         return WINEDDERR_NOTAOVERLAYSURFACE;=0A=
+    } else if(!DstSurface) {=0A=
+        WARN("(%p): Dest surface is NULL\n", This);=0A=
+        return WINED3DERR_INVALIDCALL;=0A=
+    }=0A=
+=0A=
+    if(SrcRect) {=0A=
+        This->overlay_srcrect =3D *SrcRect;=0A=
+    } else {=0A=
+        This->overlay_srcrect.left =3D 0;=0A=
+        This->overlay_srcrect.top =3D 0;=0A=
+        This->overlay_srcrect.right =3D This->currentDesc.Width;=0A=
+        This->overlay_srcrect.bottom =3D This->currentDesc.Height;=0A=
+    }=0A=
+=0A=
+    if(DstRect) {=0A=
+        This->overlay_destrect =3D *DstRect;=0A=
+    } else {=0A=
+        This->overlay_destrect.left =3D 0;=0A=
+        This->overlay_destrect.top =3D 0;=0A=
+        This->overlay_destrect.right =3D Dst ? Dst->currentDesc.Width : =
0;=0A=
+        This->overlay_destrect.bottom =3D Dst ? Dst->currentDesc.Height =
: 0;=0A=
+    }=0A=
+=0A=
+    if(Flags & WINEDDOVER_SHOW) {=0A=
+        This->overlay_dest =3D Dst;=0A=
+=0A=
+    } else if(Flags & WINEDDOVER_HIDE) {=0A=
+        /* tests show that the rectangles are erased on hide */=0A=
+        This->overlay_srcrect.left   =3D 0; This->overlay_srcrect.top   =
  =3D 0;=0A=
+        This->overlay_srcrect.right  =3D 0; =
This->overlay_srcrect.bottom  =3D 0;=0A=
+        This->overlay_destrect.left  =3D 0; This->overlay_destrect.top  =
  =3D 0;=0A=
+        This->overlay_destrect.right =3D 0; =
This->overlay_destrect.bottom =3D 0;=0A=
+        This->overlay_dest =3D NULL;=0A=
     }=0A=
 =0A=
     return WINED3D_OK;=0A=
diff --git a/dlls/wined3d/wined3d_private.h =
b/dlls/wined3d/wined3d_private.h=0A=
index 33b48df..f253d41 100644=0A=
--- a/dlls/wined3d/wined3d_private.h=0A=
+++ b/dlls/wined3d/wined3d_private.h=0A=
@@ -1326,6 +1326,11 @@ struct IWineD3DSurfaceImpl=0A=
 =0A=
     /* DirectDraw clippers */=0A=
     IWineD3DClipper           *clipper;=0A=
+=0A=
+    /* DirectDraw Overlay handling */=0A=
+    RECT                      overlay_srcrect;=0A=
+    RECT                      overlay_destrect;=0A=
+    IWineD3DSurfaceImpl       *overlay_dest;=0A=
 };=0A=
 =0A=
 extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;=0A=
diff --git a/include/wine/wined3d_interface.h =
b/include/wine/wined3d_interface.h=0A=
index 76d5843..05bc49a 100644=0A=
--- a/include/wine/wined3d_interface.h=0A=
+++ b/include/wine/wined3d_interface.h=0A=
@@ -80,6 +80,7 @@ struct IWineD3DSurface;=0A=
 #define WINEDDERR_SURFACEBUSY                       =
MAKE_WINED3DHRESULT(430)=0A=
 #define WINEDDERR_INVALIDRECT                       =
MAKE_WINED3DHRESULT(150)=0A=
 #define WINEDDERR_NOCLIPLIST                        =
MAKE_WINED3DHRESULT(205)=0A=
+#define WINEDDERR_OVERLAYNOTVISIBLE                 =
MAKE_WINED3DHRESULT( 577 )=0A=
 #define WINED3DOK_NOAUTOGEN                         =
MAKE_WINED3DSTATUS(2159)=0A=
 =0A=
  =
/************************************************************************=
*****=0A=
diff --git a/include/wine/wined3d_types.h b/include/wine/wined3d_types.h=0A=
index c4d10f5..bbfbcff 100644=0A=
--- a/include/wine/wined3d_types.h=0A=
+++ b/include/wine/wined3d_types.h=0A=
@@ -1803,4 +1803,28 @@ typedef struct _WINEDDOVERLAYFX=0A=
 #define WINEDDFLIP_INTERVAL3                    0x03000000=0A=
 #define WINEDDFLIP_INTERVAL4                    0x04000000=0A=
 =0A=
+#define WINEDDOVER_ALPHADEST                    0x00000001=0A=
+#define WINEDDOVER_ALPHADESTCONSTOVERRIDE       0x00000002=0A=
+#define WINEDDOVER_ALPHADESTNEG                 0x00000004=0A=
+#define WINEDDOVER_ALPHADESTSURFACEOVERRIDE     0x00000008=0A=
+#define WINEDDOVER_ALPHAEDGEBLEND               0x00000010=0A=
+#define WINEDDOVER_ALPHASRC                     0x00000020=0A=
+#define WINEDDOVER_ALPHASRCCONSTOVERRIDE        0x00000040=0A=
+#define WINEDDOVER_ALPHASRCNEG                  0x00000080=0A=
+#define WINEDDOVER_ALPHASRCSURFACEOVERRIDE      0x00000100=0A=
+#define WINEDDOVER_HIDE                         0x00000200=0A=
+#define WINEDDOVER_KEYDEST                      0x00000400=0A=
+#define WINEDDOVER_KEYDESTOVERRIDE              0x00000800=0A=
+#define WINEDDOVER_KEYSRC                       0x00001000=0A=
+#define WINEDDOVER_KEYSRCOVERRIDE               0x00002000=0A=
+#define WINEDDOVER_SHOW                         0x00004000=0A=
+#define WINEDDOVER_ADDDIRTYRECT                 0x00008000=0A=
+#define WINEDDOVER_REFRESHDIRTYRECTS            0x00010000=0A=
+#define WINEDDOVER_REFRESHALL                   0x00020000=0A=
+#define WINEDDOVER_DDFX                         0x00080000=0A=
+#define WINEDDOVER_AUTOFLIP                     0x00100000=0A=
+#define WINEDDOVER_BOB                          0x00200000=0A=
+#define WINEDDOVER_OVERRIDEBOBWEAVE             0x00400000=0A=
+#define WINEDDOVER_INTERLEAVED                  0x00800000=0A=
+=0A=
 #endif=0A=
-- =0A=
1.5.4.5=0A=
=0A=

------=_NextPart_000_0031_01C8F640.95859A80--




More information about the wine-patches mailing list