Commit b2c74e0c authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

amstream: Create ddraw if no source object was specified in ddraw_IAMMediaStream_Initialize().

parent 51fce87c
......@@ -218,6 +218,13 @@ static HRESULT WINAPI ddraw_IAMMediaStream_Initialize(IAMMediaStream *iface, IUn
&& FAILED(hr = IUnknown_QueryInterface(source_object, &IID_IDirectDraw, (void **)&stream->ddraw)))
FIXME("Stream object doesn't implement IDirectDraw interface, hr %#x.\n", hr);
if (!source_object)
{
if (FAILED(hr = DirectDrawCreate(NULL, &stream->ddraw, NULL)))
return hr;
IDirectDraw_SetCooperativeLevel(stream->ddraw, NULL, DDSCL_NORMAL);
}
return S_OK;
}
......@@ -381,13 +388,10 @@ static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMedi
if (!ddraw)
return E_POINTER;
*ddraw = NULL;
if (!stream->ddraw)
{
HRESULT hr = DirectDrawCreate(NULL, &stream->ddraw, NULL);
if (FAILED(hr))
return hr;
IDirectDraw_SetCooperativeLevel(stream->ddraw, NULL, DDSCL_NORMAL);
*ddraw = NULL;
return S_OK;
}
IDirectDraw_AddRef(stream->ddraw);
......
......@@ -4803,8 +4803,7 @@ static void test_ddrawstream_getsetdirectdraw(void)
hr = IDirectDrawMediaStream_GetDirectDraw(ddraw_stream, &ddraw3);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(ddraw3 == NULL, "Expected NULL, got %p.\n", ddraw3);
if (ddraw3) IDirectDraw_Release(ddraw3);
ok(ddraw3 == NULL, "Expected NULL, got %p.\n", ddraw3);
hr = IDirectDrawMediaStream_SetDirectDraw(ddraw_stream, ddraw2);
ok(hr == S_OK, "Got hr %#x.\n", hr);
......
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