windowscodecsext: Implement WICCreateColorTransform_Proxy and IWICColorTransform_Initialize_Proxy.

Hans Leidekker hans at codeweavers.com
Mon Feb 11 07:30:10 CST 2013


---
 configure.ac                                |    3 +-
 dlls/windowscodecsext/Makefile.in           |    1 +
 dlls/windowscodecsext/main.c                |   40 +++++++++++++++++
 dlls/windowscodecsext/tests/Makefile.in     |    7 +++
 dlls/windowscodecsext/tests/transform.c     |   64 +++++++++++++++++++++++++++
 dlls/windowscodecsext/windowscodecsext.spec |    4 +-
 6 files changed, 116 insertions(+), 3 deletions(-)
 create mode 100644 dlls/windowscodecsext/tests/Makefile.in
 create mode 100644 dlls/windowscodecsext/tests/transform.c

diff --git a/configure.ac b/configure.ac
index 012228c..d6fccaa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3068,7 +3068,8 @@ WINE_CONFIG_DLL(winaspi.dll16,enable_win16)
 WINE_CONFIG_DLL(windebug.dll16,enable_win16)
 WINE_CONFIG_DLL(windowscodecs,,[implib])
 WINE_CONFIG_TEST(dlls/windowscodecs/tests)
-WINE_CONFIG_DLL(windowscodecsext)
+WINE_CONFIG_DLL(windowscodecsext,,[implib])
+WINE_CONFIG_TEST(dlls/windowscodecsext/tests)
 WINE_CONFIG_DLL(winealsa.drv)
 WINE_CONFIG_DLL(winecoreaudio.drv)
 WINE_CONFIG_LIB(winecrt0)
diff --git a/dlls/windowscodecsext/Makefile.in b/dlls/windowscodecsext/Makefile.in
index de6d06c..998eca9 100644
--- a/dlls/windowscodecsext/Makefile.in
+++ b/dlls/windowscodecsext/Makefile.in
@@ -1,4 +1,5 @@
 MODULE    = windowscodecsext.dll
+IMPORTS   = ole32
 
 C_SRCS = \
 	main.c
diff --git a/dlls/windowscodecsext/main.c b/dlls/windowscodecsext/main.c
index 608096e..d7f74ff 100644
--- a/dlls/windowscodecsext/main.c
+++ b/dlls/windowscodecsext/main.c
@@ -22,8 +22,12 @@
 
 #include <stdarg.h>
 
+#define COBJMACROS
+
 #include "windef.h"
 #include "winbase.h"
+#include "initguid.h"
+#include "wincodec.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
@@ -45,3 +49,39 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
 
     return TRUE;
 }
+
+HRESULT WINAPI WICCreateColorTransform_Proxy(IWICColorTransform **ppIWICColorTransform)
+{
+    HRESULT hr, init;
+    IWICImagingFactory *factory;
+
+    TRACE("(%p)\n", ppIWICColorTransform);
+
+    if (!ppIWICColorTransform) return E_INVALIDARG;
+
+    init = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+
+    hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
+                          &IID_IWICImagingFactory, (void **)&factory);
+    if (FAILED(hr))
+    {
+        if (SUCCEEDED(init)) CoUninitialize();
+        return hr;
+    }
+    hr = IWICImagingFactory_CreateColorTransformer(factory, ppIWICColorTransform);
+    IWICImagingFactory_Release(factory);
+
+    if (SUCCEEDED(init)) CoUninitialize();
+    return hr;
+}
+
+HRESULT WINAPI IWICColorTransform_Initialize_Proxy_W(IWICColorTransform *iface,
+    IWICBitmapSource *pIBitmapSource, IWICColorContext *pIContextSource,
+    IWICColorContext *pIContextDest, REFWICPixelFormatGUID pixelFmtDest)
+{
+    TRACE("(%p,%p,%p,%p,%s)\n", iface, pIBitmapSource, pIContextSource, pIContextDest,
+          debugstr_guid(pixelFmtDest));
+
+    return IWICColorTransform_Initialize(iface, pIBitmapSource, pIContextSource,
+        pIContextDest, pixelFmtDest);
+}
diff --git a/dlls/windowscodecsext/tests/Makefile.in b/dlls/windowscodecsext/tests/Makefile.in
new file mode 100644
index 0000000..9d005aa
--- /dev/null
+++ b/dlls/windowscodecsext/tests/Makefile.in
@@ -0,0 +1,7 @@
+TESTDLL   = windowscodecsext.dll
+IMPORTS   = windowscodecsext ole32
+
+C_SRCS = \
+	transform.c
+
+ at MAKE_TEST_RULES@
diff --git a/dlls/windowscodecsext/tests/transform.c b/dlls/windowscodecsext/tests/transform.c
new file mode 100644
index 0000000..e76f9fe
--- /dev/null
+++ b/dlls/windowscodecsext/tests/transform.c
@@ -0,0 +1,64 @@
+/*
+ * 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
+ */
+
+#define COBJMACROS
+
+#include <stdio.h>
+#include "windows.h"
+#include "objbase.h"
+#include "wincodec.h"
+#include "wine/test.h"
+
+HRESULT WINAPI WICCreateColorTransform_Proxy(IWICColorTransform**);
+
+static void test_WICCreateColorTransform_Proxy(void)
+{
+    HRESULT hr;
+    IWICColorTransform *transform;
+
+    hr = WICCreateColorTransform_Proxy( NULL );
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    transform = NULL;
+    hr = WICCreateColorTransform_Proxy( &transform );
+    ok( hr == S_OK, "got %08x\n", hr );
+    if (transform) IWICColorTransform_Release( transform );
+
+    hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    transform = NULL;
+    hr = WICCreateColorTransform_Proxy( &transform );
+    ok( hr == S_OK, "got %08x\n", hr );
+    if (transform) IWICColorTransform_Release( transform );
+    CoUninitialize();
+
+    hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    transform = NULL;
+    hr = WICCreateColorTransform_Proxy( &transform );
+    ok( hr == S_OK, "got %08x\n", hr );
+    if (transform) IWICColorTransform_Release( transform );
+    CoUninitialize();
+}
+
+START_TEST(transform)
+{
+    test_WICCreateColorTransform_Proxy();
+}
diff --git a/dlls/windowscodecsext/windowscodecsext.spec b/dlls/windowscodecsext/windowscodecsext.spec
index d6b0e2b..02cfd9b 100644
--- a/dlls/windowscodecsext/windowscodecsext.spec
+++ b/dlls/windowscodecsext/windowscodecsext.spec
@@ -1,3 +1,3 @@
 @ stub DllGetClassObject
-@ stub IWICColorTransform_Initialize_Proxy
-@ stub WICCreateColorTransform_Proxy
+@ stdcall IWICColorTransform_Initialize_Proxy(ptr ptr ptr ptr ptr) IWICColorTransform_Initialize_Proxy_W
+@ stdcall WICCreateColorTransform_Proxy(ptr)
-- 
1.7.10.4






More information about the wine-patches mailing list