ddraw: Use unsafe_impl_from_IDirectDrawPalette for application provided interfaces.

This commit is contained in:
Ričardas Barkauskas 2011-10-03 17:14:08 -05:00 committed by Alexandre Julliard
parent 07decea872
commit a8616b7fcb
3 changed files with 10 additions and 1 deletions

View File

@ -369,6 +369,8 @@ struct IDirectDrawPaletteImpl
IUnknown *ifaceToRelease;
};
IDirectDrawPaletteImpl *unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *iface) DECLSPEC_HIDDEN;
HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
IDirectDrawImpl *ddraw, DWORD flags, PALETTEENTRY *entries) DECLSPEC_HIDDEN;

View File

@ -258,6 +258,13 @@ static const struct IDirectDrawPaletteVtbl ddraw_palette_vtbl =
IDirectDrawPaletteImpl_SetEntries
};
IDirectDrawPaletteImpl *unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *iface)
{
if (!iface) return NULL;
assert(iface->lpVtbl == &ddraw_palette_vtbl);
return CONTAINING_RECORD(iface, IDirectDrawPaletteImpl, lpVtbl);
}
HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
IDirectDrawImpl *ddraw, DWORD flags, PALETTEENTRY *entries)
{

View File

@ -4288,7 +4288,7 @@ static HRESULT WINAPI ddraw_surface7_SetPalette(IDirectDrawSurface7 *iface, IDir
IDirectDrawSurfaceImpl *This = impl_from_IDirectDrawSurface7(iface);
IDirectDrawPalette *oldPal;
IDirectDrawSurfaceImpl *surf;
IDirectDrawPaletteImpl *PalImpl = (IDirectDrawPaletteImpl *)Pal;
IDirectDrawPaletteImpl *PalImpl = unsafe_impl_from_IDirectDrawPalette(Pal);
HRESULT hr;
TRACE("iface %p, palette %p.\n", iface, Pal);