From e002d2eacfc5371bc4a964515448c9ad2db52e76 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 11 Feb 2013 14:30:10 +0100 Subject: [PATCH] windowscodecsext: Implement WICCreateColorTransform_Proxy and IWICColorTransform_Initialize_Proxy. --- configure | 3 +- configure.ac | 3 +- dlls/windowscodecsext/Makefile.in | 2 + dlls/windowscodecsext/main.c | 40 +++++++++++++ dlls/windowscodecsext/tests/Makefile.in | 7 +++ dlls/windowscodecsext/tests/transform.c | 64 +++++++++++++++++++++ dlls/windowscodecsext/windowscodecsext.spec | 4 +- 7 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 dlls/windowscodecsext/tests/Makefile.in create mode 100644 dlls/windowscodecsext/tests/transform.c diff --git a/configure b/configure index c5fabbad079..2998c6a5115 100755 --- a/configure +++ b/configure @@ -16184,7 +16184,8 @@ wine_fn_config_dll winaspi.dll16 enable_win16 wine_fn_config_dll windebug.dll16 enable_win16 wine_fn_config_dll windowscodecs enable_windowscodecs implib wine_fn_config_test dlls/windowscodecs/tests windowscodecs_test -wine_fn_config_dll windowscodecsext enable_windowscodecsext +wine_fn_config_dll windowscodecsext enable_windowscodecsext implib +wine_fn_config_test dlls/windowscodecsext/tests windowscodecsext_test wine_fn_config_dll winealsa.drv enable_winealsa_drv wine_fn_config_dll winecoreaudio.drv enable_winecoreaudio_drv wine_fn_config_lib winecrt0 diff --git a/configure.ac b/configure.ac index 012228cb255..d6fccaab2de 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 de6d06c0b0d..edb9b7d5c6d 100644 --- a/dlls/windowscodecsext/Makefile.in +++ b/dlls/windowscodecsext/Makefile.in @@ -1,4 +1,6 @@ MODULE = windowscodecsext.dll +IMPORTLIB = windowscodecsext +IMPORTS = ole32 C_SRCS = \ main.c diff --git a/dlls/windowscodecsext/main.c b/dlls/windowscodecsext/main.c index 608096e1039..d7f74ff614b 100644 --- a/dlls/windowscodecsext/main.c +++ b/dlls/windowscodecsext/main.c @@ -22,8 +22,12 @@ #include +#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 00000000000..9d005aabaf9 --- /dev/null +++ b/dlls/windowscodecsext/tests/Makefile.in @@ -0,0 +1,7 @@ +TESTDLL = windowscodecsext.dll +IMPORTS = windowscodecsext ole32 + +C_SRCS = \ + transform.c + +@MAKE_TEST_RULES@ diff --git a/dlls/windowscodecsext/tests/transform.c b/dlls/windowscodecsext/tests/transform.c new file mode 100644 index 00000000000..e76f9fe8a4f --- /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 +#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 d6b0e2bc7bd..02cfd9b9477 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)