2 * Copyright 2010 Vincent Povirk for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wincodecs_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
36 typedef struct BitmapScaler {
37 IWICBitmapScaler IWICBitmapScaler_iface;
41 static inline BitmapScaler *impl_from_IWICBitmapScaler(IWICBitmapScaler *iface)
43 return CONTAINING_RECORD(iface, BitmapScaler, IWICBitmapScaler_iface);
46 static HRESULT WINAPI BitmapScaler_QueryInterface(IWICBitmapScaler *iface, REFIID iid,
49 BitmapScaler *This = impl_from_IWICBitmapScaler(iface);
50 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
52 if (!ppv) return E_INVALIDARG;
54 if (IsEqualIID(&IID_IUnknown, iid) ||
55 IsEqualIID(&IID_IWICBitmapSource, iid) ||
56 IsEqualIID(&IID_IWICBitmapScaler, iid))
66 IUnknown_AddRef((IUnknown*)*ppv);
70 static ULONG WINAPI BitmapScaler_AddRef(IWICBitmapScaler *iface)
72 BitmapScaler *This = impl_from_IWICBitmapScaler(iface);
73 ULONG ref = InterlockedIncrement(&This->ref);
75 TRACE("(%p) refcount=%u\n", iface, ref);
80 static ULONG WINAPI BitmapScaler_Release(IWICBitmapScaler *iface)
82 BitmapScaler *This = impl_from_IWICBitmapScaler(iface);
83 ULONG ref = InterlockedDecrement(&This->ref);
85 TRACE("(%p) refcount=%u\n", iface, ref);
89 HeapFree(GetProcessHeap(), 0, This);
95 static HRESULT WINAPI BitmapScaler_GetSize(IWICBitmapScaler *iface,
96 UINT *puiWidth, UINT *puiHeight)
98 FIXME("(%p,%p,%p): stub\n", iface, puiWidth, puiHeight);
103 static HRESULT WINAPI BitmapScaler_GetPixelFormat(IWICBitmapScaler *iface,
104 WICPixelFormatGUID *pPixelFormat)
106 FIXME("(%p,%p): stub\n", iface, pPixelFormat);
111 static HRESULT WINAPI BitmapScaler_GetResolution(IWICBitmapScaler *iface,
112 double *pDpiX, double *pDpiY)
114 FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY);
119 static HRESULT WINAPI BitmapScaler_CopyPalette(IWICBitmapScaler *iface,
120 IWICPalette *pIPalette)
122 FIXME("(%p,%p): stub\n", iface, pIPalette);
127 static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface,
128 const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
130 FIXME("(%p,%p,%u,%u,%p): stub\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
135 static HRESULT WINAPI BitmapScaler_Initialize(IWICBitmapScaler *iface,
136 IWICBitmapSource *pISource, UINT uiWidth, UINT uiHeight,
137 WICBitmapInterpolationMode mode)
139 FIXME("(%p,%p,%u,%u,%u): stub\n", iface, pISource, uiWidth, uiHeight, mode);
144 static const IWICBitmapScalerVtbl BitmapScaler_Vtbl = {
145 BitmapScaler_QueryInterface,
147 BitmapScaler_Release,
148 BitmapScaler_GetSize,
149 BitmapScaler_GetPixelFormat,
150 BitmapScaler_GetResolution,
151 BitmapScaler_CopyPalette,
152 BitmapScaler_CopyPixels,
153 BitmapScaler_Initialize
156 HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler)
160 This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapScaler));
161 if (!This) return E_OUTOFMEMORY;
163 This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl;
166 *scaler = &This->IWICBitmapScaler_iface;