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

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

parent 7e106986
......@@ -34,7 +34,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
typedef struct FlipRotator {
const IWICBitmapFlipRotatorVtbl *lpVtbl;
IWICBitmapFlipRotator IWICBitmapFlipRotator_iface;
LONG ref;
IWICBitmapSource *source;
int flip_x;
......@@ -43,10 +43,15 @@ typedef struct FlipRotator {
CRITICAL_SECTION lock; /* must be held when initialized */
} FlipRotator;
static inline FlipRotator *impl_from_IWICBitmapFlipRotator(IWICBitmapFlipRotator *iface)
{
return CONTAINING_RECORD(iface, FlipRotator, IWICBitmapFlipRotator_iface);
}
static HRESULT WINAPI FlipRotator_QueryInterface(IWICBitmapFlipRotator *iface, REFIID iid,
void **ppv)
{
FlipRotator *This = (FlipRotator*)iface;
FlipRotator *This = impl_from_IWICBitmapFlipRotator(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG;
......@@ -69,7 +74,7 @@ static HRESULT WINAPI FlipRotator_QueryInterface(IWICBitmapFlipRotator *iface, R
static ULONG WINAPI FlipRotator_AddRef(IWICBitmapFlipRotator *iface)
{
FlipRotator *This = (FlipRotator*)iface;
FlipRotator *This = impl_from_IWICBitmapFlipRotator(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
......@@ -79,7 +84,7 @@ static ULONG WINAPI FlipRotator_AddRef(IWICBitmapFlipRotator *iface)
static ULONG WINAPI FlipRotator_Release(IWICBitmapFlipRotator *iface)
{
FlipRotator *This = (FlipRotator*)iface;
FlipRotator *This = impl_from_IWICBitmapFlipRotator(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
......@@ -98,7 +103,7 @@ static ULONG WINAPI FlipRotator_Release(IWICBitmapFlipRotator *iface)
static HRESULT WINAPI FlipRotator_GetSize(IWICBitmapFlipRotator *iface,
UINT *puiWidth, UINT *puiHeight)
{
FlipRotator *This = (FlipRotator*)iface;
FlipRotator *This = impl_from_IWICBitmapFlipRotator(iface);
TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
if (!This->source)
......@@ -135,7 +140,7 @@ static HRESULT WINAPI FlipRotator_CopyPalette(IWICBitmapFlipRotator *iface,
static HRESULT WINAPI FlipRotator_CopyPixels(IWICBitmapFlipRotator *iface,
const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
{
FlipRotator *This = (FlipRotator*)iface;
FlipRotator *This = impl_from_IWICBitmapFlipRotator(iface);
HRESULT hr;
UINT y;
UINT srcy, srcwidth, srcheight;
......@@ -194,7 +199,7 @@ static HRESULT WINAPI FlipRotator_CopyPixels(IWICBitmapFlipRotator *iface,
static HRESULT WINAPI FlipRotator_Initialize(IWICBitmapFlipRotator *iface,
IWICBitmapSource *pISource, WICBitmapTransformOptions options)
{
FlipRotator *This = (FlipRotator*)iface;
FlipRotator *This = impl_from_IWICBitmapFlipRotator(iface);
HRESULT hr=S_OK;
TRACE("(%p,%p,%u)\n", iface, pISource, options);
......@@ -253,7 +258,7 @@ HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator)
This = HeapAlloc(GetProcessHeap(), 0, sizeof(FlipRotator));
if (!This) return E_OUTOFMEMORY;
This->lpVtbl = &FlipRotator_Vtbl;
This->IWICBitmapFlipRotator_iface.lpVtbl = &FlipRotator_Vtbl;
This->ref = 1;
This->source = NULL;
This->flip_x = 0;
......@@ -262,7 +267,7 @@ HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator)
InitializeCriticalSection(&This->lock);
This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": FlipRotator.lock");
*fliprotator = (IWICBitmapFlipRotator*)This;
*fliprotator = &This->IWICBitmapFlipRotator_iface;
return S_OK;
}
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