[PATCH 1/5] ddraw: Just use a static variable for scanline emulation.

Henri Verbeet hverbeet at codeweavers.com
Tue Sep 13 13:02:23 CDT 2011


Tracking it per ddraw object doesn't add much.
---
 dlls/ddraw/ddraw.c         |   11 ++++++-----
 dlls/ddraw/ddraw_private.h |    1 -
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index faa4125..4cf7c16 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1880,29 +1880,30 @@ static HRESULT WINAPI ddraw1_WaitForVerticalBlank(IDirectDraw *iface, DWORD flag
 static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline)
 {
     IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
+    static DWORD cur_scanline;
     static BOOL hide = FALSE;
     WINED3DDISPLAYMODE Mode;
 
     TRACE("iface %p, line %p.\n", iface, Scanline);
 
     /* This function is called often, so print the fixme only once */
-    EnterCriticalSection(&ddraw_cs);
     if(!hide)
     {
         FIXME("iface %p, line %p partial stub!\n", iface, Scanline);
         hide = TRUE;
     }
 
+    EnterCriticalSection(&ddraw_cs);
     wined3d_device_get_display_mode(This->wined3d_device, 0, &Mode);
+    LeaveCriticalSection(&ddraw_cs);
 
     /* Fake the line sweeping of the monitor */
     /* FIXME: We should synchronize with a source to keep the refresh rate */
-    *Scanline = This->cur_scanline++;
+    *Scanline = cur_scanline++;
     /* Assume 20 scan lines in the vertical blank */
-    if (This->cur_scanline >= Mode.Height + 20)
-        This->cur_scanline = 0;
+    if (cur_scanline >= Mode.Height + 20)
+        cur_scanline = 0;
 
-    LeaveCriticalSection(&ddraw_cs);
     return DD_OK;
 }
 
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index 09e9aed..0731eb0 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -89,7 +89,6 @@ struct IDirectDrawImpl
     BOOL                    d3d_initialized;
 
     /* Misc ddraw fields */
-    DWORD                   cur_scanline;
     BOOL                    fake_vblank;
     BOOL                    initialized;
 
-- 
1.7.3.4




More information about the wine-patches mailing list