2 * Copyright 2012 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 BitmapImpl {
37 IWICBitmap IWICBitmap_iface;
41 static inline BitmapImpl *impl_from_IWICBitmap(IWICBitmap *iface)
43 return CONTAINING_RECORD(iface, BitmapImpl, IWICBitmap_iface);
46 static HRESULT WINAPI BitmapImpl_QueryInterface(IWICBitmap *iface, REFIID iid,
49 BitmapImpl *This = impl_from_IWICBitmap(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_IWICBitmap, iid))
58 *ppv = &This->IWICBitmap_iface;
66 IUnknown_AddRef((IUnknown*)*ppv);
70 static ULONG WINAPI BitmapImpl_AddRef(IWICBitmap *iface)
72 BitmapImpl *This = impl_from_IWICBitmap(iface);
73 ULONG ref = InterlockedIncrement(&This->ref);
75 TRACE("(%p) refcount=%u\n", iface, ref);
80 static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface)
82 BitmapImpl *This = impl_from_IWICBitmap(iface);
83 ULONG ref = InterlockedDecrement(&This->ref);
85 TRACE("(%p) refcount=%u\n", iface, ref);
89 HeapFree(GetProcessHeap(), 0, This);
95 static HRESULT WINAPI BitmapImpl_GetSize(IWICBitmap *iface,
96 UINT *puiWidth, UINT *puiHeight)
98 FIXME("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
103 static HRESULT WINAPI BitmapImpl_GetPixelFormat(IWICBitmap *iface,
104 WICPixelFormatGUID *pPixelFormat)
106 FIXME("(%p,%p)\n", iface, pPixelFormat);
111 static HRESULT WINAPI BitmapImpl_GetResolution(IWICBitmap *iface,
112 double *pDpiX, double *pDpiY)
114 FIXME("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
119 static HRESULT WINAPI BitmapImpl_CopyPalette(IWICBitmap *iface,
120 IWICPalette *pIPalette)
122 FIXME("(%p,%p)\n", iface, pIPalette);
127 static HRESULT WINAPI BitmapImpl_CopyPixels(IWICBitmap *iface,
128 const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
130 FIXME("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
135 static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock,
136 DWORD flags, IWICBitmapLock **ppILock)
138 FIXME("(%p,%p,%x,%p)\n", iface, prcLock, flags, ppILock);
143 static HRESULT WINAPI BitmapImpl_SetPalette(IWICBitmap *iface, IWICPalette *pIPalette)
145 FIXME("(%p,%p)\n", iface, pIPalette);
150 static HRESULT WINAPI BitmapImpl_SetResolution(IWICBitmap *iface,
151 double dpiX, double dpiY)
153 FIXME("(%p,%f,%f)\n", iface, dpiX, dpiY);
158 static const IWICBitmapVtbl BitmapImpl_Vtbl = {
159 BitmapImpl_QueryInterface,
163 BitmapImpl_GetPixelFormat,
164 BitmapImpl_GetResolution,
165 BitmapImpl_CopyPalette,
166 BitmapImpl_CopyPixels,
168 BitmapImpl_SetPalette,
169 BitmapImpl_SetResolution
172 HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
173 REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option,
174 IWICBitmap **ppIBitmap)
178 This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapImpl));
179 if (!This) return E_OUTOFMEMORY;
181 This->IWICBitmap_iface.lpVtbl = &BitmapImpl_Vtbl;
184 *ppIBitmap = &This->IWICBitmap_iface;