ddraw: COM cleanup for the IDirectDrawPalette interface.
This commit is contained in:
parent
a8616b7fcb
commit
a6656468ef
|
@ -3609,7 +3609,7 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags,
|
|||
}
|
||||
|
||||
TRACE("Created palette %p.\n", object);
|
||||
*Palette = (IDirectDrawPalette *)object;
|
||||
*Palette = &object->IDirectDrawPalette_iface;
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
return DD_OK;
|
||||
}
|
||||
|
@ -3626,7 +3626,7 @@ static HRESULT WINAPI ddraw4_CreatePalette(IDirectDraw4 *iface, DWORD flags, PAL
|
|||
hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown);
|
||||
if (SUCCEEDED(hr) && *palette)
|
||||
{
|
||||
IDirectDrawPaletteImpl *impl = (IDirectDrawPaletteImpl *)*palette;
|
||||
IDirectDrawPaletteImpl *impl = impl_from_IDirectDrawPalette(*palette);
|
||||
IDirectDraw7_Release(&This->IDirectDraw7_iface);
|
||||
IDirectDraw4_AddRef(iface);
|
||||
impl->ifaceToRelease = (IUnknown *)iface;
|
||||
|
@ -3646,7 +3646,7 @@ static HRESULT WINAPI ddraw2_CreatePalette(IDirectDraw2 *iface, DWORD flags,
|
|||
hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown);
|
||||
if (SUCCEEDED(hr) && *palette)
|
||||
{
|
||||
IDirectDrawPaletteImpl *impl = (IDirectDrawPaletteImpl *)*palette;
|
||||
IDirectDrawPaletteImpl *impl = impl_from_IDirectDrawPalette(*palette);
|
||||
IDirectDraw7_Release(&This->IDirectDraw7_iface);
|
||||
impl->ifaceToRelease = NULL;
|
||||
}
|
||||
|
@ -3666,7 +3666,7 @@ static HRESULT WINAPI ddraw1_CreatePalette(IDirectDraw *iface, DWORD flags,
|
|||
hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown);
|
||||
if (SUCCEEDED(hr) && *palette)
|
||||
{
|
||||
IDirectDrawPaletteImpl *impl = (IDirectDrawPaletteImpl *)*palette;
|
||||
IDirectDrawPaletteImpl *impl = impl_from_IDirectDrawPalette(*palette);
|
||||
IDirectDraw7_Release(&This->IDirectDraw7_iface);
|
||||
impl->ifaceToRelease = NULL;
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ IDirectDrawClipperImpl *unsafe_impl_from_IDirectDrawClipper(IDirectDrawClipper *
|
|||
struct IDirectDrawPaletteImpl
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IDirectDrawPaletteVtbl *lpVtbl;
|
||||
IDirectDrawPalette IDirectDrawPalette_iface;
|
||||
LONG ref;
|
||||
|
||||
struct wined3d_palette *wineD3DPalette;
|
||||
|
@ -369,6 +369,11 @@ struct IDirectDrawPaletteImpl
|
|||
IUnknown *ifaceToRelease;
|
||||
};
|
||||
|
||||
static inline IDirectDrawPaletteImpl *impl_from_IDirectDrawPalette(IDirectDrawPalette *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IDirectDrawPaletteImpl, IDirectDrawPalette_iface);
|
||||
}
|
||||
|
||||
IDirectDrawPaletteImpl *unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
|
||||
|
|
|
@ -70,7 +70,7 @@ IDirectDrawPaletteImpl_QueryInterface(IDirectDrawPalette *iface,
|
|||
static ULONG WINAPI
|
||||
IDirectDrawPaletteImpl_AddRef(IDirectDrawPalette *iface)
|
||||
{
|
||||
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
|
||||
IDirectDrawPaletteImpl *This = impl_from_IDirectDrawPalette(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("%p increasing refcount to %u.\n", This, ref);
|
||||
|
@ -90,7 +90,7 @@ IDirectDrawPaletteImpl_AddRef(IDirectDrawPalette *iface)
|
|||
static ULONG WINAPI
|
||||
IDirectDrawPaletteImpl_Release(IDirectDrawPalette *iface)
|
||||
{
|
||||
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
|
||||
IDirectDrawPaletteImpl *This = impl_from_IDirectDrawPalette(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("%p decreasing refcount to %u.\n", This, ref);
|
||||
|
@ -155,7 +155,7 @@ static HRESULT WINAPI
|
|||
IDirectDrawPaletteImpl_GetCaps(IDirectDrawPalette *iface,
|
||||
DWORD *Caps)
|
||||
{
|
||||
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
|
||||
IDirectDrawPaletteImpl *This = impl_from_IDirectDrawPalette(iface);
|
||||
|
||||
TRACE("iface %p, caps %p.\n", iface, Caps);
|
||||
|
||||
|
@ -191,7 +191,7 @@ IDirectDrawPaletteImpl_SetEntries(IDirectDrawPalette *iface,
|
|||
DWORD Count,
|
||||
PALETTEENTRY *PalEnt)
|
||||
{
|
||||
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
|
||||
IDirectDrawPaletteImpl *This = impl_from_IDirectDrawPalette(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, flags %#x, start %u, count %u, entries %p.\n",
|
||||
|
@ -230,7 +230,7 @@ IDirectDrawPaletteImpl_GetEntries(IDirectDrawPalette *iface,
|
|||
DWORD Count,
|
||||
PALETTEENTRY *PalEnt)
|
||||
{
|
||||
IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
|
||||
IDirectDrawPaletteImpl *This = impl_from_IDirectDrawPalette(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, flags %#x, start %u, count %u, entries %p.\n",
|
||||
|
@ -262,7 +262,7 @@ IDirectDrawPaletteImpl *unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *
|
|||
{
|
||||
if (!iface) return NULL;
|
||||
assert(iface->lpVtbl == &ddraw_palette_vtbl);
|
||||
return CONTAINING_RECORD(iface, IDirectDrawPaletteImpl, lpVtbl);
|
||||
return CONTAINING_RECORD(iface, IDirectDrawPaletteImpl, IDirectDrawPalette_iface);
|
||||
}
|
||||
|
||||
HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
|
||||
|
@ -270,7 +270,7 @@ HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
palette->lpVtbl = &ddraw_palette_vtbl;
|
||||
palette->IDirectDrawPalette_iface.lpVtbl = &ddraw_palette_vtbl;
|
||||
palette->ref = 1;
|
||||
|
||||
hr = wined3d_palette_create(ddraw->wined3d_device, flags,
|
||||
|
|
Loading…
Reference in New Issue