Commit 4b84c5e5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Add a separate function for clipper initialization.

parent 759fd517
......@@ -283,7 +283,7 @@ static HRESULT WINAPI IDirectDrawClipperImpl_IsClipListChanged(
/*****************************************************************************
* The VTable
*****************************************************************************/
const IDirectDrawClipperVtbl IDirectDrawClipper_Vtbl =
static const struct IDirectDrawClipperVtbl ddraw_clipper_vtbl =
{
IDirectDrawClipperImpl_QueryInterface,
IDirectDrawClipperImpl_AddRef,
......@@ -295,3 +295,17 @@ const IDirectDrawClipperVtbl IDirectDrawClipper_Vtbl =
IDirectDrawClipperImpl_SetClipList,
IDirectDrawClipperImpl_SetHwnd
};
HRESULT ddraw_clipper_init(IDirectDrawClipperImpl *clipper)
{
clipper->lpVtbl = &ddraw_clipper_vtbl;
clipper->ref = 1;
clipper->wineD3DClipper = pWineDirect3DCreateClipper((IUnknown *)clipper);
if (!clipper->wineD3DClipper)
{
WARN("Failed to create wined3d clipper.\n");
return E_OUTOFMEMORY;
}
return DD_OK;
}
......@@ -3840,6 +3840,8 @@ DirectDrawCreateClipper(DWORD Flags,
IUnknown *UnkOuter)
{
IDirectDrawClipperImpl* object;
HRESULT hr;
TRACE("(%08x,%p,%p)\n", Flags, Clipper, UnkOuter);
EnterCriticalSection(&ddraw_cs);
......@@ -3863,16 +3865,16 @@ DirectDrawCreateClipper(DWORD Flags,
return E_OUTOFMEMORY;
}
object->lpVtbl = &IDirectDrawClipper_Vtbl;
object->ref = 1;
object->wineD3DClipper = pWineDirect3DCreateClipper((IUnknown *) object);
if(!object->wineD3DClipper)
hr = ddraw_clipper_init(object);
if (FAILED(hr))
{
WARN("Failed to initialize clipper, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
LeaveCriticalSection(&ddraw_cs);
return E_OUTOFMEMORY;
return hr;
}
TRACE("Created clipper %p.\n", object);
*Clipper = (IDirectDrawClipper *) object;
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
......
......@@ -462,7 +462,7 @@ struct IDirectDrawClipperImpl
BOOL initialized;
};
extern const IDirectDrawClipperVtbl IDirectDrawClipper_Vtbl DECLSPEC_HIDDEN;
HRESULT ddraw_clipper_init(IDirectDrawClipperImpl *clipper) DECLSPEC_HIDDEN;
typeof(WineDirect3DCreateClipper) *pWineDirect3DCreateClipper DECLSPEC_HIDDEN;
......
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