Piotr Caban : ddraw: Improve GetScanLine stub so it' s usable for timing related tasks.
Alexandre Julliard
julliard at winehq.org
Fri Apr 6 14:43:25 CDT 2012
Module: wine
Branch: master
Commit: 5c85f96f33b71b8e8991d6ecbbafac9b1306cb4a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5c85f96f33b71b8e8991d6ecbbafac9b1306cb4a
Author: Piotr Caban <piotr at codeweavers.com>
Date: Fri Apr 6 14:49:54 2012 +0200
ddraw: Improve GetScanLine stub so it's usable for timing related tasks.
---
dlls/ddraw/ddraw.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 20df445..2ef51da 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1964,8 +1964,8 @@ static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline)
{
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
struct wined3d_display_mode mode;
- static DWORD cur_scanline;
static BOOL hide = FALSE;
+ DWORD time, frame_progress, lines;
TRACE("iface %p, line %p.\n", iface, Scanline);
@@ -1982,11 +1982,20 @@ static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline)
/* Fake the line sweeping of the monitor */
/* FIXME: We should synchronize with a source to keep the refresh rate */
- *Scanline = cur_scanline++;
- /* Assume 20 scan lines in the vertical blank */
- if (cur_scanline >= mode.height + 20)
- cur_scanline = 0;
+ /* Simulate a 60Hz display */
+ time = GetTickCount();
+ frame_progress = time & 15; /* time % (1000 / 60) */
+ if (!frame_progress)
+ {
+ *Scanline = 0;
+ return DDERR_VERTICALBLANKINPROGRESS;
+ }
+
+ /* Convert frame_progress to estimated scan line. Return any line from
+ * block determined by time. Some lines may be never returned */
+ lines = mode.height / 15;
+ *Scanline = (frame_progress - 1) * lines + time % lines;
return DD_OK;
}
More information about the wine-cvs
mailing list