winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
August 2009
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
4 participants
1042 discussions
Start a n
N
ew thread
Vincent Povirk : windowscodecs: Implement conversion from 16bppBGR555 to 32bppBGRA.
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: e38fd32e84727f21bc0297b9c028263440eb36b7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e38fd32e84727f21bc0297b9c…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 13 13:31:14 2009 -0500 windowscodecs: Implement conversion from 16bppBGR555 to 32bppBGRA. --- dlls/windowscodecs/converter.c | 50 ++++++++++++++++++++++++++++++++++++++++ dlls/windowscodecs/regsvr.c | 1 + 2 files changed, 51 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c index efb997e..c53a0cd 100644 --- a/dlls/windowscodecs/converter.c +++ b/dlls/windowscodecs/converter.c @@ -36,6 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); struct FormatConverter; enum pixelformat { + format_16bppBGR555, format_32bppBGR, format_32bppBGRA }; @@ -64,6 +65,54 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe { switch (source_format) { + case format_16bppBGR555: + if (prc) + { + HRESULT res; + UINT x, y; + BYTE *srcdata; + UINT srcstride, srcdatasize; + const BYTE *srcrow; + const WORD *srcpixel; + BYTE *dstrow; + DWORD *dstpixel; + + srcstride = 2 * prc->Width; + srcdatasize = srcstride * prc->Height; + + srcdata = HeapAlloc(GetProcessHeap(), 0, srcdatasize); + if (!srcdata) return E_OUTOFMEMORY; + + res = IWICBitmapSource_CopyPixels(This->source, prc, srcstride, srcdatasize, srcdata); + + if (SUCCEEDED(res)) + { + srcrow = srcdata; + dstrow = pbBuffer; + for (y=0; y<prc->Height; y++) { + srcpixel=(const WORD*)srcrow; + dstpixel=(DWORD*)dstrow; + for (x=0; x<prc->Width; x++) { + WORD srcval; + srcval=*srcpixel++; + *dstpixel++=0xff000000 | /* constant 255 alpha */ + ((srcval << 9) & 0xf80000) | /* r */ + ((srcval << 4) & 0x070000) | /* r - 3 bits */ + ((srcval << 6) & 0x00f800) | /* g */ + ((srcval << 1) & 0x000700) | /* g - 3 bits */ + ((srcval << 3) & 0x0000f8) | /* b */ + ((srcval >> 2) & 0x000007); /* b - 3 bits */ + } + srcrow += srcstride; + dstrow += cbStride; + } + } + + HeapFree(GetProcessHeap(), 0, srcdata); + + return res; + } + return S_OK; case format_32bppBGR: if (prc) { @@ -104,6 +153,7 @@ static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRec } static const struct pixelformatinfo supported_formats[] = { + {format_16bppBGR555, &GUID_WICPixelFormat16bppBGR555, NULL}, {format_32bppBGR, &GUID_WICPixelFormat32bppBGR, copypixels_to_32bppBGR}, {format_32bppBGRA, &GUID_WICPixelFormat32bppBGRA, copypixels_to_32bppBGRA}, {0} diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c index acda9d6..f8e2f3f 100644 --- a/dlls/windowscodecs/regsvr.c +++ b/dlls/windowscodecs/regsvr.c @@ -789,6 +789,7 @@ static struct regsvr_decoder const decoder_list[] = { }; static GUID const * const converter_formats[] = { + &GUID_WICPixelFormat16bppBGR555, &GUID_WICPixelFormat32bppBGR, &GUID_WICPixelFormat32bppBGRA, NULL
1
0
0
0
Vincent Povirk : windowscodecs: Implement WICConvertBitmapSource.
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: e308b67807456402d904530f6afe80ee84875799 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e308b67807456402d904530f6…
Author: Vincent Povirk <madewokherd(a)gmail.com> Date: Sat Aug 8 22:28:01 2009 -0500 windowscodecs: Implement WICConvertBitmapSource. --- dlls/windowscodecs/info.c | 110 +++++++++++++++++++++++++++++++++ dlls/windowscodecs/windowscodecs.spec | 2 +- 2 files changed, 111 insertions(+), 1 deletions(-) diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index d4be4e4..a89759b 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -36,6 +36,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); +static WCHAR const pixelformats_keyname[] = {'P','i','x','e','l','F','o','r','m','a','t','s',0}; + typedef struct { const IWICBitmapDecoderInfoVtbl *lpIWICBitmapDecoderInfoVtbl; LONG ref; @@ -593,6 +595,26 @@ static HRESULT WINAPI FormatConverterInfo_CreateInstance(IWICFormatConverterInfo &IID_IWICFormatConverter, (void**)ppIFormatConverter); } +static BOOL ConverterSupportsFormat(IWICFormatConverterInfo *iface, const WCHAR *formatguid) +{ + LONG res; + FormatConverterInfo *This = (FormatConverterInfo*)iface; + HKEY formats_key, guid_key; + + /* Avoid testing using IWICFormatConverter_GetPixelFormats because that + would be O(n). A registry test should do better. */ + + res = RegOpenKeyExW(This->classkey, pixelformats_keyname, 0, KEY_READ, &formats_key); + if (res != ERROR_SUCCESS) return FALSE; + + res = RegOpenKeyExW(formats_key, formatguid, 0, KEY_READ, &guid_key); + if (res == ERROR_SUCCESS) RegCloseKey(guid_key); + + RegCloseKey(formats_key); + + return (res == ERROR_SUCCESS); +} + static const IWICFormatConverterInfoVtbl FormatConverterInfo_Vtbl = { FormatConverterInfo_QueryInterface, FormatConverterInfo_AddRef, @@ -958,3 +980,91 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn return hr; } + +HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst) +{ + HRESULT res; + IEnumUnknown *enumconverters; + IUnknown *unkconverterinfo; + IWICFormatConverterInfo *converterinfo=NULL; + IWICFormatConverter *converter=NULL; + GUID srcFormat; + WCHAR srcformatstr[39], dstformatstr[39]; + BOOL canconvert; + ULONG num_fetched; + + res = IWICBitmapSource_GetPixelFormat(pISrc, &srcFormat); + if (FAILED(res)) return res; + + if (IsEqualGUID(&srcFormat, dstFormat)) + { + IWICBitmapSource_AddRef(pISrc); + *ppIDst = pISrc; + return S_OK; + } + + StringFromGUID2(&srcFormat, srcformatstr, 39); + StringFromGUID2(dstFormat, dstformatstr, 39); + + res = CreateComponentEnumerator(WICPixelFormatConverter, 0, &enumconverters); + if (FAILED(res)) return res; + + while (!converter) + { + res = IEnumUnknown_Next(enumconverters, 1, &unkconverterinfo, &num_fetched); + + if (res == S_OK) + { + res = IUnknown_QueryInterface(unkconverterinfo, &IID_IWICFormatConverterInfo, (void**)&converterinfo); + + if (SUCCEEDED(res)) + { + canconvert = ConverterSupportsFormat(converterinfo, srcformatstr); + + if (canconvert) + canconvert = ConverterSupportsFormat(converterinfo, dstformatstr); + + if (canconvert) + { + res = IWICFormatConverterInfo_CreateInstance(converterinfo, &converter); + + if (SUCCEEDED(res)) + res = IWICFormatConverter_CanConvert(converter, &srcFormat, dstFormat, &canconvert); + + if (SUCCEEDED(res) && canconvert) + res = IWICFormatConverter_Initialize(converter, pISrc, dstFormat, WICBitmapDitherTypeNone, + NULL, 0.0, WICBitmapPaletteTypeCustom); + + if (FAILED(res) || !canconvert) + { + if (converter) + { + IWICFormatConverter_Release(converter); + converter = NULL; + } + res = S_OK; + } + } + + IWICFormatConverterInfo_Release(converterinfo); + } + + IUnknown_Release(unkconverterinfo); + } + else + break; + } + + IEnumUnknown_Release(enumconverters); + + if (converter) + { + *ppIDst = (IWICBitmapSource*)converter; + return S_OK; + } + else + { + *ppIDst = NULL; + return WINCODEC_ERR_COMPONENTNOTFOUND; + } +} diff --git a/dlls/windowscodecs/windowscodecs.spec b/dlls/windowscodecs/windowscodecs.spec index 8e3729e..d0b6a7e 100644 --- a/dlls/windowscodecs/windowscodecs.spec +++ b/dlls/windowscodecs/windowscodecs.spec @@ -103,7 +103,7 @@ @ stub IWICPixelFormatInfo_GetChannelMask_Proxy @ stub IWICStream_InitializeFromIStream_Proxy @ stub IWICStream_InitializeFromMemory_Proxy -@ stub WICConvertBitmapSource +@ stdcall WICConvertBitmapSource(ptr ptr ptr) @ stub WICCreateBitmapFromSection @ stub WICCreateColorContext_Proxy @ stub WICCreateImagingFactory_Proxy
1
0
0
0
Vincent Povirk : windowscodecs: Register the default pixel format converter .
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: 26b78d1a70035c2c74aa967e7c49f0b2a3931445 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=26b78d1a70035c2c74aa967e7…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 13 10:40:59 2009 -0500 windowscodecs: Register the default pixel format converter. --- dlls/windowscodecs/regsvr.c | 192 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 192 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c index 5da76b2..acda9d6 100644 --- a/dlls/windowscodecs/regsvr.c +++ b/dlls/windowscodecs/regsvr.c @@ -81,6 +81,19 @@ struct regsvr_decoder static HRESULT register_decoders(struct regsvr_decoder const *list); static HRESULT unregister_decoders(struct regsvr_decoder const *list); +struct regsvr_converter +{ + CLSID const *clsid; /* NULL for end of list */ + LPCSTR author; + LPCSTR friendlyname; + LPCSTR version; + GUID const *vendor; + GUID const * const *formats; +}; + +static HRESULT register_converters(struct regsvr_converter const *list); +static HRESULT unregister_converters(struct regsvr_converter const *list); + /*********************************************************************** * static string constants */ @@ -116,6 +129,7 @@ static char const position_valuename[] = "Position"; static char const pattern_valuename[] = "Pattern"; static char const mask_valuename[] = "Mask"; static char const endofstream_valuename[] = "EndOfStream"; +static WCHAR const pixelformats_keyname[] = {'P','i','x','e','l','F','o','r','m','a','t','s',0}; /*********************************************************************** * static helper functions @@ -459,6 +473,163 @@ error_return: } /*********************************************************************** + * register_converters + */ +static HRESULT register_converters(struct regsvr_converter const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY coclass_key; + WCHAR buf[39]; + HKEY converters_key; + HKEY instance_key; + + res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL); + if (res == ERROR_SUCCESS) { + StringFromGUID2(&CATID_WICFormatConverters, buf, 39); + res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &converters_key, NULL); + if (res == ERROR_SUCCESS) + { + res = RegCreateKeyExW(converters_key, instance_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &instance_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + } + if (res != ERROR_SUCCESS) + RegCloseKey(coclass_key); + } + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->clsid; ++list) { + HKEY clsid_key; + HKEY instance_clsid_key; + + StringFromGUID2(list->clsid, buf, 39); + res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + + StringFromGUID2(list->clsid, buf, 39); + res = RegCreateKeyExW(instance_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); + if (res == ERROR_SUCCESS) { + res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, + (CONST BYTE*)(buf), 78); + RegCloseKey(instance_clsid_key); + } + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + + if (list->author) { + res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, + (CONST BYTE*)(list->author), + strlen(list->author) + 1); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->friendlyname) { + res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, + (CONST BYTE*)(list->friendlyname), + strlen(list->friendlyname) + 1); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->vendor) { + StringFromGUID2(list->vendor, buf, 39); + res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, + (CONST BYTE*)(buf), 78); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->version) { + res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, + (CONST BYTE*)(list->version), + strlen(list->version) + 1); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->formats) { + HKEY formats_key; + GUID const * const *format; + + res = RegCreateKeyExW(clsid_key, pixelformats_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &formats_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + for (format=list->formats; *format; ++format) + { + HKEY format_key; + StringFromGUID2(*format, buf, 39); + res = RegCreateKeyExW(formats_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &format_key, NULL); + if (res != ERROR_SUCCESS) break; + RegCloseKey(format_key); + } + RegCloseKey(formats_key); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + error_close_clsid_key: + RegCloseKey(clsid_key); + } + +error_close_coclass_key: + RegCloseKey(instance_key); + RegCloseKey(converters_key); + RegCloseKey(coclass_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * unregister_converters + */ +static HRESULT unregister_converters(struct regsvr_converter const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY coclass_key; + WCHAR buf[39]; + HKEY converters_key; + HKEY instance_key; + + res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, + KEY_READ | KEY_WRITE, &coclass_key); + if (res == ERROR_FILE_NOT_FOUND) return S_OK; + + if (res == ERROR_SUCCESS) { + StringFromGUID2(&CATID_WICFormatConverters, buf, 39); + res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &converters_key, NULL); + if (res == ERROR_SUCCESS) + { + res = RegCreateKeyExW(converters_key, instance_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &instance_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + } + if (res != ERROR_SUCCESS) + RegCloseKey(coclass_key); + } + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->clsid; ++list) { + StringFromGUID2(list->clsid, buf, 39); + + res = RegDeleteTreeW(coclass_key, buf); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + + res = RegDeleteTreeW(instance_key, buf); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + } + +error_close_coclass_key: + RegCloseKey(instance_key); + RegCloseKey(converters_key); + RegCloseKey(coclass_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** * register_key_defvalueW */ static LONG register_key_defvalueW( @@ -617,6 +788,23 @@ static struct regsvr_decoder const decoder_list[] = { { NULL } /* list terminator */ }; +static GUID const * const converter_formats[] = { + &GUID_WICPixelFormat32bppBGR, + &GUID_WICPixelFormat32bppBGRA, + NULL +}; + +static struct regsvr_converter const converter_list[] = { + { &CLSID_WICDefaultFormatConverter, + "The Wine Project", + "Default Pixel Format Converter", + "1.0.0.0", + &GUID_VendorMicrosoft, + converter_formats + }, + { NULL } /* list terminator */ +}; + HRESULT WINAPI DllRegisterServer(void) { HRESULT hr; @@ -626,6 +814,8 @@ HRESULT WINAPI DllRegisterServer(void) hr = register_coclasses(coclass_list); if (SUCCEEDED(hr)) register_decoders(decoder_list); + if (SUCCEEDED(hr)) + register_converters(converter_list); return hr; } @@ -638,5 +828,7 @@ HRESULT WINAPI DllUnregisterServer(void) hr = unregister_coclasses(coclass_list); if (SUCCEEDED(hr)) unregister_decoders(decoder_list); + if (SUCCEEDED(hr)) + unregister_converters(converter_list); return hr; }
1
0
0
0
Vincent Povirk : windowscodecs: Add stub implementation of IWICFormatConverterInfo.
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: 85c379f6a1126bee288dcbc4966c25d3b235bff4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=85c379f6a1126bee288dcbc49…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 13 10:34:05 2009 -0500 windowscodecs: Add stub implementation of IWICFormatConverterInfo. --- dlls/windowscodecs/info.c | 166 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 166 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index e8a70c3..d4be4e4 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -464,6 +464,171 @@ static HRESULT BitmapDecoderInfo_Constructor(HKEY classkey, REFCLSID clsid, IWIC return S_OK; } +typedef struct { + const IWICFormatConverterInfoVtbl *lpIWICFormatConverterInfoVtbl; + LONG ref; + HKEY classkey; + CLSID clsid; +} FormatConverterInfo; + +static HRESULT WINAPI FormatConverterInfo_QueryInterface(IWICFormatConverterInfo *iface, REFIID iid, + void **ppv) +{ + FormatConverterInfo *This = (FormatConverterInfo*)iface; + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IWICComponentInfo, iid) || + IsEqualIID(&IID_IWICFormatConverterInfo ,iid)) + { + *ppv = This; + } + else + { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI FormatConverterInfo_AddRef(IWICFormatConverterInfo *iface) +{ + FormatConverterInfo *This = (FormatConverterInfo*)iface; + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI FormatConverterInfo_Release(IWICFormatConverterInfo *iface) +{ + FormatConverterInfo *This = (FormatConverterInfo*)iface; + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + { + RegCloseKey(This->classkey); + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI FormatConverterInfo_GetComponentType(IWICFormatConverterInfo *iface, + WICComponentType *pType) +{ + TRACE("(%p,%p)\n", iface, pType); + *pType = WICPixelFormatConverter; + return S_OK; +} + +static HRESULT WINAPI FormatConverterInfo_GetCLSID(IWICFormatConverterInfo *iface, CLSID *pclsid) +{ + FIXME("(%p,%p): stub\n", iface, pclsid); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetSigningStatus(IWICFormatConverterInfo *iface, DWORD *pStatus) +{ + FIXME("(%p,%p): stub\n", iface, pStatus); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetAuthor(IWICFormatConverterInfo *iface, UINT cchAuthor, + WCHAR *wzAuthor, UINT *pcchActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cchAuthor, wzAuthor, pcchActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetVendorGUID(IWICFormatConverterInfo *iface, GUID *pguidVendor) +{ + FIXME("(%p,%p): stub\n", iface, pguidVendor); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetVersion(IWICFormatConverterInfo *iface, UINT cchVersion, + WCHAR *wzVersion, UINT *pcchActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cchVersion, wzVersion, pcchActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetSpecVersion(IWICFormatConverterInfo *iface, UINT cchSpecVersion, + WCHAR *wzSpecVersion, UINT *pcchActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cchSpecVersion, wzSpecVersion, pcchActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetFriendlyName(IWICFormatConverterInfo *iface, UINT cchFriendlyName, + WCHAR *wzFriendlyName, UINT *pcchActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cchFriendlyName, wzFriendlyName, pcchActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetPixelFormats(IWICFormatConverterInfo *iface, + UINT cFormats, GUID *pguidPixelFormats, UINT *pcActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cFormats, pguidPixelFormats, pcActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_CreateInstance(IWICFormatConverterInfo *iface, + IWICFormatConverter **ppIFormatConverter) +{ + FormatConverterInfo *This = (FormatConverterInfo*)iface; + + TRACE("(%p,%p)\n", iface, ppIFormatConverter); + + return CoCreateInstance(&This->clsid, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICFormatConverter, (void**)ppIFormatConverter); +} + +static const IWICFormatConverterInfoVtbl FormatConverterInfo_Vtbl = { + FormatConverterInfo_QueryInterface, + FormatConverterInfo_AddRef, + FormatConverterInfo_Release, + FormatConverterInfo_GetComponentType, + FormatConverterInfo_GetCLSID, + FormatConverterInfo_GetSigningStatus, + FormatConverterInfo_GetAuthor, + FormatConverterInfo_GetVendorGUID, + FormatConverterInfo_GetVersion, + FormatConverterInfo_GetSpecVersion, + FormatConverterInfo_GetFriendlyName, + FormatConverterInfo_GetPixelFormats, + FormatConverterInfo_CreateInstance +}; + +static HRESULT FormatConverterInfo_Constructor(HKEY classkey, REFCLSID clsid, IWICComponentInfo **ppIInfo) +{ + FormatConverterInfo *This; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(FormatConverterInfo)); + if (!This) + { + RegCloseKey(classkey); + return E_OUTOFMEMORY; + } + + This->lpIWICFormatConverterInfoVtbl = &FormatConverterInfo_Vtbl; + This->ref = 1; + This->classkey = classkey; + memcpy(&This->clsid, clsid, sizeof(CLSID)); + + *ppIInfo = (IWICComponentInfo*)This; + return S_OK; +} + static WCHAR const clsid_keyname[] = {'C','L','S','I','D',0}; static WCHAR const instance_keyname[] = {'I','n','s','t','a','n','c','e',0}; @@ -475,6 +640,7 @@ struct category { static const struct category categories[] = { {WICDecoder, &CATID_WICBitmapDecoders, BitmapDecoderInfo_Constructor}, + {WICPixelFormatConverter, &CATID_WICFormatConverters, FormatConverterInfo_Constructor}, {0} };
1
0
0
0
Vincent Povirk : windowscodecs: Implement conversion to 32bppBGR.
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: 83807312b9cb269324b9eee78dd5f2e3354a26c9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=83807312b9cb269324b9eee78…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 13 12:46:44 2009 -0500 windowscodecs: Implement conversion to 32bppBGR. --- dlls/windowscodecs/converter.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c index 0f851bc..efb997e 100644 --- a/dlls/windowscodecs/converter.c +++ b/dlls/windowscodecs/converter.c @@ -88,8 +88,23 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe } } +static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRect *prc, + UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) +{ + switch (source_format) + { + case format_32bppBGR: + case format_32bppBGRA: + if (prc) + return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer); + return S_OK; + default: + return copypixels_to_32bppBGRA(This, prc, cbStride, cbBufferSize, pbBuffer, source_format); + } +} + static const struct pixelformatinfo supported_formats[] = { - {format_32bppBGR, &GUID_WICPixelFormat32bppBGR, NULL}, + {format_32bppBGR, &GUID_WICPixelFormat32bppBGR, copypixels_to_32bppBGR}, {format_32bppBGRA, &GUID_WICPixelFormat32bppBGRA, copypixels_to_32bppBGRA}, {0} };
1
0
0
0
Vincent Povirk : windowscodecs: Implement GetPixelFormat for default format converter.
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: fa54c2e1aa0e58a9ac7daf33562207f7d0f3c74b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fa54c2e1aa0e58a9ac7daf335…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 13 12:43:05 2009 -0500 windowscodecs: Implement GetPixelFormat for default format converter. --- dlls/windowscodecs/converter.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c index 300e37c..0f851bc 100644 --- a/dlls/windowscodecs/converter.c +++ b/dlls/windowscodecs/converter.c @@ -170,8 +170,16 @@ static HRESULT WINAPI FormatConverter_GetSize(IWICFormatConverter *iface, static HRESULT WINAPI FormatConverter_GetPixelFormat(IWICFormatConverter *iface, WICPixelFormatGUID *pPixelFormat) { - FIXME("(%p,%p): stub\n", iface, pPixelFormat); - return E_NOTIMPL; + FormatConverter *This = (FormatConverter*)iface; + + TRACE("(%p,%p): stub\n", iface, pPixelFormat); + + if (This->source) + memcpy(pPixelFormat, This->dst_format->guid, sizeof(GUID)); + else + return WINCODEC_ERR_NOTINITIALIZED; + + return S_OK; } static HRESULT WINAPI FormatConverter_GetResolution(IWICFormatConverter *iface,
1
0
0
0
Vincent Povirk : windowscodecs: Implement GetSize/ Resolution for default format converter.
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: 05ddbfbf30de20db7448769565dfff8f0c0cc4a8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=05ddbfbf30de20db744876956…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 13 12:38:02 2009 -0500 windowscodecs: Implement GetSize/Resolution for default format converter. --- dlls/windowscodecs/converter.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c index c6663d7..300e37c 100644 --- a/dlls/windowscodecs/converter.c +++ b/dlls/windowscodecs/converter.c @@ -157,8 +157,14 @@ static ULONG WINAPI FormatConverter_Release(IWICFormatConverter *iface) static HRESULT WINAPI FormatConverter_GetSize(IWICFormatConverter *iface, UINT *puiWidth, UINT *puiHeight) { - FIXME("(%p,%p,%p): stub\n", iface, puiWidth, puiHeight); - return E_NOTIMPL; + FormatConverter *This = (FormatConverter*)iface; + + TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight); + + if (This->source) + return IWICBitmapSource_GetSize(This->source, puiWidth, puiHeight); + else + return WINCODEC_ERR_NOTINITIALIZED; } static HRESULT WINAPI FormatConverter_GetPixelFormat(IWICFormatConverter *iface, @@ -171,8 +177,14 @@ static HRESULT WINAPI FormatConverter_GetPixelFormat(IWICFormatConverter *iface, static HRESULT WINAPI FormatConverter_GetResolution(IWICFormatConverter *iface, double *pDpiX, double *pDpiY) { - FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY); - return E_NOTIMPL; + FormatConverter *This = (FormatConverter*)iface; + + TRACE("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY); + + if (This->source) + return IWICBitmapSource_GetResolution(This->source, pDpiX, pDpiY); + else + return WINCODEC_ERR_NOTINITIALIZED; } static HRESULT WINAPI FormatConverter_CopyPalette(IWICFormatConverter *iface,
1
0
0
0
Vincent Povirk : windowscodecs: Implement conversion from 32bppBGR to 32bppBGRA.
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: d7d3618414c7b9f71bd104495aefda8646aa9fdf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d7d3618414c7b9f71bd104495…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 13 12:31:39 2009 -0500 windowscodecs: Implement conversion from 32bppBGR to 32bppBGRA. --- dlls/windowscodecs/converter.c | 135 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 129 insertions(+), 6 deletions(-) diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c index 8ed5b86..c6663d7 100644 --- a/dlls/windowscodecs/converter.c +++ b/dlls/windowscodecs/converter.c @@ -33,11 +33,77 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); +struct FormatConverter; + +enum pixelformat { + format_32bppBGR, + format_32bppBGRA +}; + +typedef HRESULT (*copyfunc)(struct FormatConverter *This, const WICRect *prc, + UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format); + +struct pixelformatinfo { + enum pixelformat format; + const WICPixelFormatGUID *guid; + copyfunc copy_function; +}; + typedef struct FormatConverter { const IWICFormatConverterVtbl *lpVtbl; LONG ref; + IWICBitmapSource *source; + const struct pixelformatinfo *dst_format, *src_format; + WICBitmapDitherType dither; + double alpha_threshold; + WICBitmapPaletteType palette_type; } FormatConverter; +static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRect *prc, + UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) +{ + switch (source_format) + { + case format_32bppBGR: + if (prc) + { + HRESULT res; + UINT x, y; + + res = IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer); + if (FAILED(res)) return res; + + /* set all alpha values to 255 */ + for (y=0; y<prc->Height; y++) + for (x=0; x<prc->Width; x++) + pbBuffer[cbStride*y+4*x+3] = 0xff; + } + return S_OK; + case format_32bppBGRA: + if (prc) + return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer); + return S_OK; + default: + return WINCODEC_ERR_UNSUPPORTEDOPERATION; + } +} + +static const struct pixelformatinfo supported_formats[] = { + {format_32bppBGR, &GUID_WICPixelFormat32bppBGR, NULL}, + {format_32bppBGRA, &GUID_WICPixelFormat32bppBGRA, copypixels_to_32bppBGRA}, + {0} +}; + +static const struct pixelformatinfo *get_formatinfo(const WICPixelFormatGUID *format) +{ + UINT i; + + for (i=0; supported_formats[i].guid; i++) + if (IsEqualGUID(supported_formats[i].guid, format)) return &supported_formats[i]; + + return NULL; +} + static HRESULT WINAPI FormatConverter_QueryInterface(IWICFormatConverter *iface, REFIID iid, void **ppv) { @@ -81,6 +147,7 @@ static ULONG WINAPI FormatConverter_Release(IWICFormatConverter *iface) if (ref == 0) { + if (This->source) IWICBitmapSource_Release(This->source); HeapFree(GetProcessHeap(), 0, This); } @@ -118,26 +185,81 @@ static HRESULT WINAPI FormatConverter_CopyPalette(IWICFormatConverter *iface, static HRESULT WINAPI FormatConverter_CopyPixels(IWICFormatConverter *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer) { - FIXME("(%p,%p,%u,%u,%p): stub\n", iface, prc, cbStride, cbBufferSize, pbBuffer); - return E_NOTIMPL; + FormatConverter *This = (FormatConverter*)iface; + TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer); + + if (This->source) + return This->dst_format->copy_function(This, prc, cbStride, cbBufferSize, + pbBuffer, This->src_format->format); + else + return WINCODEC_ERR_NOTINITIALIZED; } static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface, IWICBitmapSource *pISource, REFWICPixelFormatGUID dstFormat, WICBitmapDitherType dither, IWICPalette *pIPalette, double alphaThresholdPercent, WICBitmapPaletteType paletteTranslate) { - FIXME("(%p,%p,%s,%u,%p,%0.1f,%u): stub\n", iface, pISource, debugstr_guid(dstFormat), + FormatConverter *This = (FormatConverter*)iface; + const struct pixelformatinfo *srcinfo, *dstinfo; + static INT fixme=0; + GUID srcFormat; + HRESULT res; + + TRACE("(%p,%p,%s,%u,%p,%0.1f,%u)\n", iface, pISource, debugstr_guid(dstFormat), dither, pIPalette, alphaThresholdPercent, paletteTranslate); - return E_NOTIMPL; + + if (pIPalette && !fixme++) FIXME("ignoring palette"); + + if (This->source) return WINCODEC_ERR_WRONGSTATE; + + res = IWICBitmapSource_GetPixelFormat(pISource, &srcFormat); + if (FAILED(res)) return res; + + srcinfo = get_formatinfo(&srcFormat); + if (!srcinfo) return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; + + dstinfo = get_formatinfo(dstFormat); + if (!dstinfo) return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; + + if (dstinfo->copy_function) + { + IWICBitmapSource_AddRef(pISource); + This->source = pISource; + This->src_format = srcinfo; + This->dst_format = dstinfo; + This->dither = dither; + This->alpha_threshold = alphaThresholdPercent; + This->palette_type = paletteTranslate; + } + else + return WINCODEC_ERR_UNSUPPORTEDOPERATION; + + return S_OK; } static HRESULT WINAPI FormatConverter_CanConvert(IWICFormatConverter *iface, REFWICPixelFormatGUID srcPixelFormat, REFWICPixelFormatGUID dstPixelFormat, BOOL *pfCanConvert) { - FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(srcPixelFormat), + FormatConverter *This = (FormatConverter*)iface; + const struct pixelformatinfo *srcinfo, *dstinfo; + + TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(srcPixelFormat), debugstr_guid(dstPixelFormat), pfCanConvert); - return E_NOTIMPL; + + srcinfo = get_formatinfo(srcPixelFormat); + if (!srcinfo) return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; + + dstinfo = get_formatinfo(dstPixelFormat); + if (!dstinfo) return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; + + if (dstinfo->copy_function && + SUCCEEDED(dstinfo->copy_function(This, NULL, 0, 0, NULL, dstinfo->format))) + *pfCanConvert = TRUE; + else + *pfCanConvert = FALSE; + + return S_OK; } static const IWICFormatConverterVtbl FormatConverter_Vtbl = { @@ -169,6 +291,7 @@ HRESULT FormatConverter_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** p This->lpVtbl = &FormatConverter_Vtbl; This->ref = 1; + This->source = NULL; ret = IUnknown_QueryInterface((IUnknown*)This, iid, ppv); IUnknown_Release((IUnknown*)This);
1
0
0
0
Vincent Povirk : windowscodecs: Add stub implementation of WICStandardFormatConverter.
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: b3f02a3fd5e0639072dc14152591b10a714b3b07 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b3f02a3fd5e0639072dc14152…
Author: Vincent Povirk <madewokherd(a)gmail.com> Date: Wed Aug 5 20:49:37 2009 -0500 windowscodecs: Add stub implementation of WICStandardFormatConverter. --- dlls/windowscodecs/Makefile.in | 1 + dlls/windowscodecs/clsfactory.c | 1 + dlls/windowscodecs/converter.c | 177 ++++++++++++++++++++++++++++++++ dlls/windowscodecs/regsvr.c | 6 + dlls/windowscodecs/wincodecs_private.h | 1 + 5 files changed, 186 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in index 3f652e1..aaf2c94 100644 --- a/dlls/windowscodecs/Makefile.in +++ b/dlls/windowscodecs/Makefile.in @@ -10,6 +10,7 @@ C_SRCS = \ bmpdecode.c \ bmpencode.c \ clsfactory.c \ + converter.c \ imgfactory.c \ info.c \ main.c \ diff --git a/dlls/windowscodecs/clsfactory.c b/dlls/windowscodecs/clsfactory.c index cd68d91..3adb99b 100644 --- a/dlls/windowscodecs/clsfactory.c +++ b/dlls/windowscodecs/clsfactory.c @@ -45,6 +45,7 @@ static classinfo wic_classes[] = { {&CLSID_WICImagingFactory, ImagingFactory_CreateInstance}, {&CLSID_WICBmpDecoder, BmpDecoder_CreateInstance}, {&CLSID_WICBmpEncoder, BmpEncoder_CreateInstance}, + {&CLSID_WICDefaultFormatConverter, FormatConverter_CreateInstance}, {0}}; typedef struct { diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c new file mode 100644 index 0000000..8ed5b86 --- /dev/null +++ b/dlls/windowscodecs/converter.c @@ -0,0 +1,177 @@ +/* + * Copyright 2009 Vincent Povirk + * + * 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 FormatConverter { + const IWICFormatConverterVtbl *lpVtbl; + LONG ref; +} FormatConverter; + +static HRESULT WINAPI FormatConverter_QueryInterface(IWICFormatConverter *iface, REFIID iid, + void **ppv) +{ + FormatConverter *This = (FormatConverter*)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_IWICFormatConverter, iid)) + { + *ppv = This; + } + else + { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI FormatConverter_AddRef(IWICFormatConverter *iface) +{ + FormatConverter *This = (FormatConverter*)iface; + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI FormatConverter_Release(IWICFormatConverter *iface) +{ + FormatConverter *This = (FormatConverter*)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 FormatConverter_GetSize(IWICFormatConverter *iface, + UINT *puiWidth, UINT *puiHeight) +{ + FIXME("(%p,%p,%p): stub\n", iface, puiWidth, puiHeight); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverter_GetPixelFormat(IWICFormatConverter *iface, + WICPixelFormatGUID *pPixelFormat) +{ + FIXME("(%p,%p): stub\n", iface, pPixelFormat); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverter_GetResolution(IWICFormatConverter *iface, + double *pDpiX, double *pDpiY) +{ + FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverter_CopyPalette(IWICFormatConverter *iface, + IWICPalette *pIPalette) +{ + FIXME("(%p,%p): stub\n", iface, pIPalette); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverter_CopyPixels(IWICFormatConverter *iface, + const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer) +{ + FIXME("(%p,%p,%u,%u,%p): stub\n", iface, prc, cbStride, cbBufferSize, pbBuffer); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface, + IWICBitmapSource *pISource, REFWICPixelFormatGUID dstFormat, WICBitmapDitherType dither, + IWICPalette *pIPalette, double alphaThresholdPercent, WICBitmapPaletteType paletteTranslate) +{ + FIXME("(%p,%p,%s,%u,%p,%0.1f,%u): stub\n", iface, pISource, debugstr_guid(dstFormat), + dither, pIPalette, alphaThresholdPercent, paletteTranslate); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverter_CanConvert(IWICFormatConverter *iface, + REFWICPixelFormatGUID srcPixelFormat, REFWICPixelFormatGUID dstPixelFormat, + BOOL *pfCanConvert) +{ + FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(srcPixelFormat), + debugstr_guid(dstPixelFormat), pfCanConvert); + return E_NOTIMPL; +} + +static const IWICFormatConverterVtbl FormatConverter_Vtbl = { + FormatConverter_QueryInterface, + FormatConverter_AddRef, + FormatConverter_Release, + FormatConverter_GetSize, + FormatConverter_GetPixelFormat, + FormatConverter_GetResolution, + FormatConverter_CopyPalette, + FormatConverter_CopyPixels, + FormatConverter_Initialize, + FormatConverter_CanConvert +}; + +HRESULT FormatConverter_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +{ + FormatConverter *This; + HRESULT ret; + + TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + + *ppv = NULL; + + if (pUnkOuter) return CLASS_E_NOAGGREGATION; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(FormatConverter)); + if (!This) return E_OUTOFMEMORY; + + This->lpVtbl = &FormatConverter_Vtbl; + This->ref = 1; + + ret = IUnknown_QueryInterface((IUnknown*)This, iid, ppv); + IUnknown_Release((IUnknown*)This); + + return ret; +} diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c index b6327f3..5da76b2 100644 --- a/dlls/windowscodecs/regsvr.c +++ b/dlls/windowscodecs/regsvr.c @@ -570,6 +570,12 @@ static struct regsvr_coclass const coclass_list[] = { "windowscodecs.dll", "Apartment" }, + { &CLSID_WICDefaultFormatConverter, + "WIC Default Format Converter", + NULL, + "windowscodecs.dll", + "Apartment" + }, { NULL } /* list terminator */ }; diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h index 680dc23..70e3c16 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -19,6 +19,7 @@ #ifndef WINCODECS_PRIVATE_H #define WINCODECS_PRIVATE_H +extern HRESULT FormatConverter_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv); extern HRESULT ImagingFactory_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv); extern HRESULT BmpDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv); extern HRESULT BmpEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv);
1
0
0
0
Vincent Povirk : include: Add definitions needed for WIC pixel format conversion.
by Alexandre Julliard
14 Aug '09
14 Aug '09
Module: wine Branch: master Commit: ef2956bd903f0576abe5fa18dd0c63596a08786c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ef2956bd903f0576abe5fa18d…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 13 09:38:14 2009 -0500 include: Add definitions needed for WIC pixel format conversion. --- include/wincodec.idl | 56 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 55 insertions(+), 1 deletions(-) diff --git a/include/wincodec.idl b/include/wincodec.idl index ae53a2a..80601c1 100644 --- a/include/wincodec.idl +++ b/include/wincodec.idl @@ -51,6 +51,20 @@ typedef enum WICBitmapDecoderCapabilities { WICBitmapDecoderCapabilityCanDecodeThumbnail = 0x00000010, } WICBitmapDecoderCapabilities; +typedef enum WICBitmapDitherType { + WICBitmapDitherTypeNone = 0x00000000, + WICBitmapDitherTypeSolid = 0x00000000, + WICBitmapDitherTypeOrdered4x4 = 0x00000001, + WICBitmapDitherTypeOrdered8x8 = 0x00000002, + WICBitmapDitherTypeOrdered16x16 = 0x00000003, + WICBitmapDitherTypeSpiral4x4 = 0x00000004, + WICBitmapDitherTypeSpiral8x8 = 0x00000005, + WICBitmapDitherTypeDualSpiral4x4 = 0x00000006, + WICBitmapDitherTypeDualSpiral8x8 = 0x00000007, + WICBitmapDitherTypeErrorDiffusion = 0x00000008, + WICBITMAPDITHERTYPE_FORCE_DWORD = CODEC_FORCE_DWORD +} WICBitmapDitherType; + typedef enum WICBitmapEncoderCacheOption { WICBitmapEncoderCacheInMemory = 0x00000000, WICBitmapEncoderCacheTempFile = 0x00000001, @@ -141,12 +155,12 @@ cpp_quote("#define WINCODEC_ERR_NOTINITIALIZED 0x88982f0c") cpp_quote("#define WINCODEC_ERR_CODECNOTHUMBNAIL 0x88982f44") cpp_quote("#define WINCODEC_ERR_PALETTEUNAVAILABLE 0x88982f45") cpp_quote("#define WINCODEC_ERR_COMPONENTNOTFOUND 0x88982f50") +cpp_quote("#define WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT 0x88982f80") cpp_quote("#define WINCODEC_ERR_UNSUPPORTEDOPERATION 0x88982f81") cpp_quote("#define WINCODEC_ERR_INSUFFICIENTBUFFER 0x88982f8c") interface IWICBitmap; interface IWICPalette; -interface IWICFormatConverter; interface IWICBitmapScaler; interface IWICBitmapClipper; interface IWICBitmapFlipRotator; @@ -506,6 +520,41 @@ interface IWICBitmapEncoder : IUnknown [ object, + uuid(00000301-a8f2-4877-ba0a-fd2b6645fb94) +] +interface IWICFormatConverter : IWICBitmapSource +{ + HRESULT Initialize( + [in] IWICBitmapSource *pISource, + [in] REFWICPixelFormatGUID dstFormat, + [in] WICBitmapDitherType dither, + [in] IWICPalette *pIPalette, + [in] double alphaThresholdPercent, + [in] WICBitmapPaletteType paletteTranslate); + + HRESULT CanConvert( + [in] REFWICPixelFormatGUID srcPixelFormat, + [in] REFWICPixelFormatGUID dstPixelFormat, + [out] BOOL *pfCanConvert); +} + +[ + object, + uuid(9f34fb65-13f4-4f15-bc57-3726b5e53d9f) +] +interface IWICFormatConverterInfo : IWICComponentInfo +{ + HRESULT GetPixelFormats( + [in] UINT cFormats, + [in, out, size_is(cFormats)] WICPixelFormatGUID *pPixelFormatGUIDs, + [out] UINT *pcActual); + + HRESULT CreateInstance( + [out] IWICFormatConverter **ppIConverter); +} + +[ + object, uuid(135ff860-22b7-4ddf-b0f6-218f4f299a43) ] interface IWICStream : IStream @@ -655,6 +704,8 @@ interface IWICImagingFactory : IUnknown [out] IWICMetadataQueryWriter **ppIQueryWriter); } +cpp_quote("HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst);") + cpp_quote("DEFINE_GUID(CLSID_WICBmpDecoder, 0x6b462062,0x7cbf,0x400d,0x9f,0xdb,0x81,0x3d,0xd1,0x0f,0x27,0x78);") cpp_quote("DEFINE_GUID(CLSID_WICPngDecoder, 0x389ea17b,0x5078,0x4cde,0xb6,0xef,0x25,0xc1,0x51,0x75,0xc7,0x51);") cpp_quote("DEFINE_GUID(CLSID_WICIcoDecoder, 0xc61bfcdf,0x2e0f,0x4aad,0xa8,0xd7,0xe0,0x6b,0xaf,0xeb,0xcd,0xfe);") @@ -670,6 +721,8 @@ cpp_quote("DEFINE_GUID(CLSID_WICGifEncoder, 0x114f5598,0x0b22,0x40a0,0x86,0xa1,0 cpp_quote("DEFINE_GUID(CLSID_WICTiffEncoder, 0x0131be10,0x2001,0x4c5f,0xa9,0xb0,0xcc,0x88,0xfa,0xb6,0x4c,0xe8);") cpp_quote("DEFINE_GUID(CLSID_WICWmpEncoder, 0xac4ce3cb,0xe1c1,0x44cd,0x82,0x15,0x5a,0x16,0x65,0x50,0x9e,0xc2);") +cpp_quote("DEFINE_GUID(CLSID_WICDefaultFormatConverter, 0x1a3f11dc,0xb514,0x4b17,0x8c,0x5f,0x21,0x54,0x51,0x38,0x52,0xf1);") + cpp_quote("DEFINE_GUID(GUID_ContainerFormatBmp, 0x0af1d87e,0xfcfe,0x4188,0xbd,0xeb,0xa7,0x90,0x64,0x71,0xcb,0xe3);") cpp_quote("DEFINE_GUID(GUID_ContainerFormatPng, 0x1b7cfaf4,0x713f,0x473c,0xbb,0xcd,0x61,0x37,0x42,0x5f,0xae,0xaf);") cpp_quote("DEFINE_GUID(GUID_ContainerFormatIco, 0xa3a860c4,0x338f,0x4c17,0x91,0x9a,0xfb,0xa4,0xb5,0x62,0x8f,0x21);") @@ -682,3 +735,4 @@ cpp_quote("DEFINE_GUID(GUID_VendorMicrosoft, 0xf0e749ca,0xedef,0x4589,0xa7,0x3a, cpp_quote("DEFINE_GUID(CATID_WICBitmapDecoders, 0x7ed96837,0x96f0,0x4812,0xb2,0x11,0xf1,0x3c,0x24,0x11,0x7e,0xd3);") cpp_quote("DEFINE_GUID(CATID_WICBitmapEncoders, 0xac757296,0x3522,0x4e11,0x98,0x62,0xc1,0x7b,0xe5,0xa1,0x76,0x7e);") +cpp_quote("DEFINE_GUID(CATID_WICFormatConverters, 0x7835eae8,0xbf14,0x49d1,0x93,0xce,0x53,0x3a,0x40,0x7b,0x22,0x48);")
1
0
0
0
← Newer
1
...
56
57
58
59
60
61
62
...
105
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Results per page:
10
25
50
100
200