Commit 5c85f96f authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

ddraw: Improve GetScanLine stub so it's usable for timing related tasks.

parent 6f9e3308
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment