Commit 43130843 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

windowscodecs: Use an iface instead of a vtbl pointer in PaletteImpl.

parent e97fb503
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
typedef struct { typedef struct {
const IWICPaletteVtbl *lpIWICPaletteVtbl; IWICPalette IWICPalette_iface;
LONG ref; LONG ref;
UINT count; UINT count;
WICColor *colors; WICColor *colors;
...@@ -43,10 +43,15 @@ typedef struct { ...@@ -43,10 +43,15 @@ typedef struct {
CRITICAL_SECTION lock; /* must be held when count, colors, or type is accessed */ CRITICAL_SECTION lock; /* must be held when count, colors, or type is accessed */
} PaletteImpl; } PaletteImpl;
static inline PaletteImpl *impl_from_IWICPalette(IWICPalette *iface)
{
return CONTAINING_RECORD(iface, PaletteImpl, IWICPalette_iface);
}
static HRESULT WINAPI PaletteImpl_QueryInterface(IWICPalette *iface, REFIID iid, static HRESULT WINAPI PaletteImpl_QueryInterface(IWICPalette *iface, REFIID iid,
void **ppv) void **ppv)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG; if (!ppv) return E_INVALIDARG;
...@@ -67,7 +72,7 @@ static HRESULT WINAPI PaletteImpl_QueryInterface(IWICPalette *iface, REFIID iid, ...@@ -67,7 +72,7 @@ static HRESULT WINAPI PaletteImpl_QueryInterface(IWICPalette *iface, REFIID iid,
static ULONG WINAPI PaletteImpl_AddRef(IWICPalette *iface) static ULONG WINAPI PaletteImpl_AddRef(IWICPalette *iface)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref); TRACE("(%p) refcount=%u\n", iface, ref);
...@@ -77,7 +82,7 @@ static ULONG WINAPI PaletteImpl_AddRef(IWICPalette *iface) ...@@ -77,7 +82,7 @@ static ULONG WINAPI PaletteImpl_AddRef(IWICPalette *iface)
static ULONG WINAPI PaletteImpl_Release(IWICPalette *iface) static ULONG WINAPI PaletteImpl_Release(IWICPalette *iface)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref); TRACE("(%p) refcount=%u\n", iface, ref);
...@@ -103,7 +108,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface, ...@@ -103,7 +108,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
static HRESULT WINAPI PaletteImpl_InitializeCustom(IWICPalette *iface, static HRESULT WINAPI PaletteImpl_InitializeCustom(IWICPalette *iface,
WICColor *pColors, UINT colorCount) WICColor *pColors, UINT colorCount)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
WICColor *new_colors; WICColor *new_colors;
TRACE("(%p,%p,%u)\n", iface, pColors, colorCount); TRACE("(%p,%p,%u)\n", iface, pColors, colorCount);
...@@ -147,7 +152,7 @@ static HRESULT WINAPI PaletteImpl_InitializeFromPalette(IWICPalette *iface, ...@@ -147,7 +152,7 @@ static HRESULT WINAPI PaletteImpl_InitializeFromPalette(IWICPalette *iface,
static HRESULT WINAPI PaletteImpl_GetType(IWICPalette *iface, static HRESULT WINAPI PaletteImpl_GetType(IWICPalette *iface,
WICBitmapPaletteType *pePaletteType) WICBitmapPaletteType *pePaletteType)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
TRACE("(%p,%p)\n", iface, pePaletteType); TRACE("(%p,%p)\n", iface, pePaletteType);
...@@ -162,7 +167,7 @@ static HRESULT WINAPI PaletteImpl_GetType(IWICPalette *iface, ...@@ -162,7 +167,7 @@ static HRESULT WINAPI PaletteImpl_GetType(IWICPalette *iface,
static HRESULT WINAPI PaletteImpl_GetColorCount(IWICPalette *iface, UINT *pcCount) static HRESULT WINAPI PaletteImpl_GetColorCount(IWICPalette *iface, UINT *pcCount)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
TRACE("(%p,%p)\n", iface, pcCount); TRACE("(%p,%p)\n", iface, pcCount);
...@@ -178,7 +183,7 @@ static HRESULT WINAPI PaletteImpl_GetColorCount(IWICPalette *iface, UINT *pcCoun ...@@ -178,7 +183,7 @@ static HRESULT WINAPI PaletteImpl_GetColorCount(IWICPalette *iface, UINT *pcCoun
static HRESULT WINAPI PaletteImpl_GetColors(IWICPalette *iface, UINT colorCount, static HRESULT WINAPI PaletteImpl_GetColors(IWICPalette *iface, UINT colorCount,
WICColor *pColors, UINT *pcActualColors) WICColor *pColors, UINT *pcActualColors)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
TRACE("(%p,%i,%p,%p)\n", iface, colorCount, pColors, pcActualColors); TRACE("(%p,%i,%p,%p)\n", iface, colorCount, pColors, pcActualColors);
...@@ -199,7 +204,7 @@ static HRESULT WINAPI PaletteImpl_GetColors(IWICPalette *iface, UINT colorCount, ...@@ -199,7 +204,7 @@ static HRESULT WINAPI PaletteImpl_GetColors(IWICPalette *iface, UINT colorCount,
static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBlackWhite) static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBlackWhite)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
TRACE("(%p,%p)\n", iface, pfIsBlackWhite); TRACE("(%p,%p)\n", iface, pfIsBlackWhite);
...@@ -217,7 +222,7 @@ static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBla ...@@ -217,7 +222,7 @@ static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBla
static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGrayscale) static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGrayscale)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
TRACE("(%p,%p)\n", iface, pfIsGrayscale); TRACE("(%p,%p)\n", iface, pfIsGrayscale);
...@@ -242,7 +247,7 @@ static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGray ...@@ -242,7 +247,7 @@ static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGray
static HRESULT WINAPI PaletteImpl_HasAlpha(IWICPalette *iface, BOOL *pfHasAlpha) static HRESULT WINAPI PaletteImpl_HasAlpha(IWICPalette *iface, BOOL *pfHasAlpha)
{ {
PaletteImpl *This = (PaletteImpl*)iface; PaletteImpl *This = impl_from_IWICPalette(iface);
int i; int i;
TRACE("(%p,%p)\n", iface, pfHasAlpha); TRACE("(%p,%p)\n", iface, pfHasAlpha);
...@@ -286,7 +291,7 @@ HRESULT PaletteImpl_Create(IWICPalette **palette) ...@@ -286,7 +291,7 @@ HRESULT PaletteImpl_Create(IWICPalette **palette)
This = HeapAlloc(GetProcessHeap(), 0, sizeof(PaletteImpl)); This = HeapAlloc(GetProcessHeap(), 0, sizeof(PaletteImpl));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->lpIWICPaletteVtbl = &PaletteImpl_Vtbl; This->IWICPalette_iface.lpVtbl = &PaletteImpl_Vtbl;
This->ref = 1; This->ref = 1;
This->count = 0; This->count = 0;
This->colors = NULL; This->colors = NULL;
......
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