[2/4] windowscodecs: Add a stub IWICColorTransform implementation.
Hans Leidekker
hans at codeweavers.com
Wed Feb 6 06:52:09 CST 2013
---
dlls/windowscodecs/Makefile.in | 1 +
dlls/windowscodecs/colortransform.c | 166 ++++++++++++++++++++++++++++++++
dlls/windowscodecs/imgfactory.c | 4 +-
dlls/windowscodecs/wincodecs_private.h | 1 +
4 files changed, 170 insertions(+), 2 deletions(-)
create mode 100644 dlls/windowscodecs/colortransform.c
diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in
index ffe0925..4035279 100644
--- a/dlls/windowscodecs/Makefile.in
+++ b/dlls/windowscodecs/Makefile.in
@@ -11,6 +11,7 @@ C_SRCS = \
bmpencode.c \
clsfactory.c \
colorcontext.c \
+ colortransform.c \
converter.c \
fliprotate.c \
gifformat.c \
diff --git a/dlls/windowscodecs/colortransform.c b/dlls/windowscodecs/colortransform.c
new file mode 100644
index 0000000..dae4f38
--- /dev/null
+++ b/dlls/windowscodecs/colortransform.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2013 Hans Leidekker for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+#include "wincodec.h"
+
+#include "wincodecs_private.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
+
+typedef struct ColorTransform {
+ IWICColorTransform IWICColorTransform_iface;
+ LONG ref;
+} ColorTransform;
+
+static inline ColorTransform *impl_from_IWICColorTransform(IWICColorTransform *iface)
+{
+ return CONTAINING_RECORD(iface, ColorTransform, IWICColorTransform_iface);
+}
+
+static HRESULT WINAPI ColorTransform_QueryInterface(IWICColorTransform *iface, REFIID iid,
+ void **ppv)
+{
+ ColorTransform *This = impl_from_IWICColorTransform(iface);
+ TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
+
+ if (!ppv) return E_INVALIDARG;
+
+ if (IsEqualIID(&IID_IUnknown, iid) ||
+ IsEqualIID(&IID_IWICBitmapSource, iid) ||
+ IsEqualIID(&IID_IWICColorTransform, iid))
+ {
+ *ppv = &This->IWICColorTransform_iface;
+ }
+ else
+ {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
+}
+
+static ULONG WINAPI ColorTransform_AddRef(IWICColorTransform *iface)
+{
+ ColorTransform *This = impl_from_IWICColorTransform(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) refcount=%u\n", iface, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI ColorTransform_Release(IWICColorTransform *iface)
+{
+ ColorTransform *This = impl_from_IWICColorTransform(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) refcount=%u\n", iface, ref);
+
+ if (ref == 0)
+ {
+ HeapFree(GetProcessHeap(), 0, This);
+ }
+
+ return ref;
+}
+
+static HRESULT WINAPI ColorTransform_GetSize(IWICColorTransform *iface,
+ UINT *puiWidth, UINT *puiHeight)
+{
+ FIXME("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ColorTransform_GetPixelFormat(IWICColorTransform *iface,
+ WICPixelFormatGUID *pPixelFormat)
+{
+ FIXME("(%p,%p)\n", iface, pPixelFormat);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ColorTransform_GetResolution(IWICColorTransform *iface,
+ double *pDpiX, double *pDpiY)
+{
+ FIXME("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ColorTransform_CopyPalette(IWICColorTransform *iface,
+ IWICPalette *pIPalette)
+{
+ FIXME("(%p,%p)\n", iface, pIPalette);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ColorTransform_CopyPixels(IWICColorTransform *iface,
+ const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
+{
+ FIXME("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ColorTransform_Initialize(IWICColorTransform *iface,
+ IWICBitmapSource *pIBitmapSource, IWICColorContext *pIContextSource,
+ IWICColorContext *pIContextDest, REFWICPixelFormatGUID pixelFmtDest)
+{
+ FIXME("(%p,%p,%p,%p,%s)\n", iface, pIBitmapSource, pIContextSource,
+ pIContextDest, debugstr_guid(pixelFmtDest));
+ return E_NOTIMPL;
+}
+
+static const IWICColorTransformVtbl ColorTransform_Vtbl = {
+ ColorTransform_QueryInterface,
+ ColorTransform_AddRef,
+ ColorTransform_Release,
+ ColorTransform_GetSize,
+ ColorTransform_GetPixelFormat,
+ ColorTransform_GetResolution,
+ ColorTransform_CopyPalette,
+ ColorTransform_CopyPixels,
+ ColorTransform_Initialize
+};
+
+HRESULT ColorTransform_Create(IWICColorTransform **colortransform)
+{
+ ColorTransform *This;
+
+ if (!colortransform) return E_INVALIDARG;
+
+ This = HeapAlloc(GetProcessHeap(), 0, sizeof(ColorTransform));
+ if (!This) return E_OUTOFMEMORY;
+
+ This->IWICColorTransform_iface.lpVtbl = &ColorTransform_Vtbl;
+ This->ref = 1;
+
+ *colortransform = &This->IWICColorTransform_iface;
+
+ return S_OK;
+}
diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c
index 7965c55..223b041 100644
--- a/dlls/windowscodecs/imgfactory.c
+++ b/dlls/windowscodecs/imgfactory.c
@@ -450,8 +450,8 @@ static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory *
static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory *iface,
IWICColorTransform **ppIColorTransform)
{
- FIXME("(%p,%p): stub\n", iface, ppIColorTransform);
- return E_NOTIMPL;
+ TRACE("(%p,%p)\n", iface, ppIColorTransform);
+ return ColorTransform_Create(ppIColorTransform);
}
static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface,
diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h
index 617db71..8eae4a7 100644
--- a/dlls/windowscodecs/wincodecs_private.h
+++ b/dlls/windowscodecs/wincodecs_private.h
@@ -53,6 +53,7 @@ extern HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator) DECLSPEC_
extern HRESULT PaletteImpl_Create(IWICPalette **palette) DECLSPEC_HIDDEN;
extern HRESULT StreamImpl_Create(IWICStream **stream) DECLSPEC_HIDDEN;
extern HRESULT ColorContext_Create(IWICColorContext **context) DECLSPEC_HIDDEN;
+extern HRESULT ColorTransform_Create(IWICColorTransform **transform) DECLSPEC_HIDDEN;
extern HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer,
UINT srcwidth, UINT srcheight, INT srcstride,
--
1.7.10.4
More information about the wine-patches
mailing list