Commit e5d69ba9 authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

ddraw: Separate IDirectDrawGammaControl reference count.

parent 90112e97
......@@ -161,7 +161,7 @@ struct IDirectDrawSurfaceImpl
const IDirect3DTexture2Vtbl *IDirect3DTexture2_vtbl;
const IDirect3DTextureVtbl *IDirect3DTexture_vtbl;
LONG ref7, ref4, ref3, ref2, ref1, iface_count;
LONG ref7, ref4, ref3, ref2, ref1, iface_count, gamma_count;
IUnknown *ifaceToRelease;
int version;
......
......@@ -111,7 +111,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface,
}
else if( IsEqualGUID(riid, &IID_IDirectDrawGammaControl) )
{
IUnknown_AddRef(iface);
IDirectDrawGammaControl_AddRef(&This->IDirectDrawGammaControl_iface);
*obj = &This->IDirectDrawGammaControl_iface;
TRACE("(%p) returning IDirectDrawGammaControl interface at %p\n", This, *obj);
return S_OK;
......@@ -318,10 +318,16 @@ static ULONG WINAPI ddraw_surface1_AddRef(IDirectDrawSurface *iface)
static ULONG WINAPI ddraw_gamma_control_AddRef(IDirectDrawGammaControl *iface)
{
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawGammaControl(iface);
ULONG refcount = InterlockedIncrement(&This->gamma_count);
TRACE("iface %p.\n", iface);
TRACE("iface %p increasing refcount to %u.\n", iface, refcount);
if (refcount == 1)
{
ddraw_surface_add_iface(This);
}
return ddraw_surface7_AddRef(&This->IDirectDrawSurface7_iface);
return refcount;
}
static ULONG WINAPI d3d_texture2_AddRef(IDirect3DTexture2 *iface)
......@@ -595,10 +601,16 @@ static ULONG WINAPI ddraw_surface1_Release(IDirectDrawSurface *iface)
static ULONG WINAPI ddraw_gamma_control_Release(IDirectDrawGammaControl *iface)
{
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawGammaControl(iface);
ULONG refcount = InterlockedDecrement(&This->gamma_count);
TRACE("iface %p.\n", iface);
TRACE("iface %p decreasing refcount to %u.\n", iface, refcount);
if (refcount == 0)
{
ddraw_surface_release_iface(This);
}
return ddraw_surface7_Release(&This->IDirectDrawSurface7_iface);
return refcount;
}
static ULONG WINAPI d3d_texture2_Release(IDirect3DTexture2 *iface)
......
......@@ -1125,7 +1125,7 @@ static void IFaceRefCount(void)
IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawGammaControl, (void **) &gamma);
ref = getRefcount((IUnknown *) gamma);
todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref);
ok(ref == 1, "Refcount is %u, expected 1\n", ref);
ref = IDirect3DTexture2_Release(tex2); /* Release the texture */
ok(ref == 2, "Refcount is %u, expected 2\n", ref);
......@@ -1138,7 +1138,7 @@ static void IFaceRefCount(void)
ok(ref == 1, "Refcount is %u, expected 1\n", ref);
ref = IDirectDrawGammaControl_Release(gamma); /* Release the gamma control */
todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref);
ok(ref == 0, "Refcount is %u, expected 0\n", ref);
}
ref = IDirectDrawSurface2_Release(surf2); /* Release one of the 2 surf2 interfaces */
......
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