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
February 2020
----- 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
2 participants
874 discussions
Start a n
N
ew thread
Vincent Povirk : mscoree: Remove appdomain tracking.
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: 22e58b11a7c3b44c16a5537b9ebfd9f621fb7537 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=22e58b11a7c3b44c16a5537b…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Feb 19 10:11:05 2020 -0600 mscoree: Remove appdomain tracking. This didn't work correctly with multiple runtime versions. We should rely on Mono to keep track of AppDomains. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mscoree/corruntimehost.c | 73 ++++-------------------------------------- dlls/mscoree/metahost.c | 22 +++++++++++++ dlls/mscoree/mscoree_private.h | 4 +-- 3 files changed, 31 insertions(+), 68 deletions(-) diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c index a900ed6a3e..a8fc2674ac 100644 --- a/dlls/mscoree/corruntimehost.c +++ b/dlls/mscoree/corruntimehost.c @@ -127,54 +127,19 @@ static void domain_restore(MonoDomain *prev_domain) mono_domain_set(prev_domain, FALSE); } -static HRESULT RuntimeHost_AddDefaultDomain(RuntimeHost *This, MonoDomain **result) -{ - struct DomainEntry *entry; - HRESULT res=S_OK; - - EnterCriticalSection(&This->lock); - - entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry)); - if (!entry) - { - res = E_OUTOFMEMORY; - goto end; - } - - /* FIXME: Use exe filename to name the domain? */ - entry->domain = mono_jit_init_version("mscorlib.dll", "v4.0.30319"); - - if (!entry->domain) - { - HeapFree(GetProcessHeap(), 0, entry); - res = E_FAIL; - goto end; - } - - is_mono_started = TRUE; - - list_add_tail(&This->domains, &entry->entry); - - *result = entry->domain; - -end: - LeaveCriticalSection(&This->lock); - - return res; -} - static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *config_path, MonoDomain **result) { WCHAR config_dir[MAX_PATH]; WCHAR base_dir[MAX_PATH]; char *base_dirA, *config_pathA, *slash; HRESULT res=S_OK; + static BOOL configured_domain; - EnterCriticalSection(&This->lock); + *result = get_root_domain(); - if (This->default_domain) goto end; + EnterCriticalSection(&This->lock); - res = RuntimeHost_AddDefaultDomain(This, &This->default_domain); + if (configured_domain) goto end; if (!config_path) { @@ -213,40 +178,20 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf *(slash + 1) = 0; TRACE("setting base_dir: %s, config_path: %s\n", base_dirA, config_pathA); - mono_domain_set_config(This->default_domain, base_dirA, config_pathA); + mono_domain_set_config(*result, base_dirA, config_pathA); HeapFree(GetProcessHeap(), 0, config_pathA); HeapFree(GetProcessHeap(), 0, base_dirA); end: - *result = This->default_domain; + + configured_domain = TRUE; LeaveCriticalSection(&This->lock); return res; } -static void RuntimeHost_DeleteDomain(RuntimeHost *This, MonoDomain *domain) -{ - struct DomainEntry *entry; - - EnterCriticalSection(&This->lock); - - LIST_FOR_EACH_ENTRY(entry, &This->domains, struct DomainEntry, entry) - { - if (entry->domain == domain) - { - list_remove(&entry->entry); - if (This->default_domain == domain) - This->default_domain = NULL; - HeapFree(GetProcessHeap(), 0, entry); - break; - } - } - - LeaveCriticalSection(&This->lock); -} - static BOOL RuntimeHost_GetMethod(MonoDomain *domain, const char *assemblyname, const char *namespace, const char *typename, const char *methodname, int arg_count, MonoMethod **method) @@ -1529,8 +1474,6 @@ __int32 WINAPI _CorExeMain(void) ERR("couldn't load %s, status=%d\n", debugstr_w(filename), status); exit_code = -1; } - - RuntimeHost_DeleteDomain(host, domain); } else exit_code = -1; @@ -1616,8 +1559,6 @@ HRESULT RuntimeHost_Construct(CLRRuntimeInfo *runtime_version, RuntimeHost** res This->ref = 1; This->version = runtime_version; - list_init(&This->domains); - This->default_domain = NULL; InitializeCriticalSection(&This->lock); This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RuntimeHost.lock"); diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index 4c1e4e97c1..3786f3afc5 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -298,6 +298,28 @@ fail: return E_FAIL; } +MonoDomain* get_root_domain(void) +{ + static MonoDomain* root_domain; + + if (root_domain != NULL) + return root_domain; + + EnterCriticalSection(&runtime_list_cs); + + if (root_domain == NULL) + { + /* FIXME: Use exe filename to name the domain? */ + root_domain = mono_jit_init_version("mscorlib.dll", "v4.0.30319"); + + is_mono_started = TRUE; + } + + LeaveCriticalSection(&runtime_list_cs); + + return root_domain; +} + static void CDECL mono_shutdown_callback_fn(MonoProfiler *prof) { is_mono_shutdown = TRUE; diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h index d5f78b61f0..5b6c398761 100644 --- a/dlls/mscoree/mscoree_private.h +++ b/dlls/mscoree/mscoree_private.h @@ -76,8 +76,6 @@ struct RuntimeHost ICorRuntimeHost ICorRuntimeHost_iface; ICLRRuntimeHost ICLRRuntimeHost_iface; CLRRuntimeInfo *version; - struct list domains; - MonoDomain *default_domain; CRITICAL_SECTION lock; LONG ref; }; @@ -110,6 +108,8 @@ extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config extern BOOL get_mono_path(LPWSTR path, BOOL skip_local) DECLSPEC_HIDDEN; +extern MonoDomain* get_root_domain(void); + extern HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result) DECLSPEC_HIDDEN; extern HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk) DECLSPEC_HIDDEN;
1
0
0
0
Daniel Lehman : include: Fix compile error with C++ winelib.
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: 2c23a77ccc9dcb36720a25638cec0742e1f0710e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2c23a77ccc9dcb36720a2563…
Author: Daniel Lehman <dlehman25(a)gmail.com> Date: Tue Feb 18 23:01:27 2020 -0800 include: Fix compile error with C++ winelib. Signed-off-by: Daniel Lehman <dlehman25(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/msvcrt/wchar.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h index 119f8a2a41..e6a5e57fd2 100644 --- a/include/msvcrt/wchar.h +++ b/include/msvcrt/wchar.h @@ -421,12 +421,12 @@ static inline int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n) static inline wchar_t* __cdecl wmemcpy(wchar_t *dst, const wchar_t *src, size_t n) { - return memcpy(dst, src, n * sizeof(wchar_t)); + return (wchar_t*)memcpy(dst, src, n * sizeof(wchar_t)); } static inline wchar_t* __cdecl wmemmove(wchar_t *dst, const wchar_t *src, size_t n) { - return memmove(dst, src, n * sizeof(wchar_t)); + return (wchar_t*)memmove(dst, src, n * sizeof(wchar_t)); } static inline wchar_t* __cdecl wmemset(wchar_t *s, wchar_t c, size_t n)
1
0
0
0
Florian Will : gdiplus: Implement GdipSaveAddImage() and GdipSaveAdd().
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: a7fc06f62cf6bd691b86abba24d83292bd1399e8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a7fc06f62cf6bd691b86abba…
Author: Florian Will <florian.will(a)gmail.com> Date: Wed Feb 19 08:47:07 2020 +0100 gdiplus: Implement GdipSaveAddImage() and GdipSaveAdd(). Signed-off-by: Florian Will <florian.will(a)gmail.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/image.c | 56 +++++++++++++++++++++++++++++++++++++++------- dlls/gdiplus/tests/image.c | 24 ++++++++++---------- 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 94c03ede19..f33e2328bf 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -4426,6 +4426,9 @@ GpStatus WINGDIPAPI GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filenam if (!image || !filename|| !clsidEncoder) return InvalidParameter; + /* this might release an old file stream held by the encoder so we can re-create it below */ + terminate_encoder_wic(image); + stat = GdipCreateStreamOnFile(filename, GENERIC_WRITE, &stream); if (stat != Ok) return GenericError; @@ -4598,6 +4601,29 @@ static GpStatus encode_frame_wic(IWICBitmapEncoder *encoder, GpImage *image) return hresult_to_status(hr); } +static BOOL has_encoder_param_long(GDIPCONST EncoderParameters *params, GUID param_guid, ULONG val) +{ + int param_idx, value_idx; + + if (!params) + return FALSE; + + for (param_idx = 0; param_idx < params->Count; param_idx++) + { + EncoderParameter param = params->Parameter[param_idx]; + if (param.Type == EncoderParameterValueTypeLong && IsEqualCLSID(¶m.Guid, ¶m_guid)) + { + ULONG *value_array = (ULONG*) param.Value; + for (value_idx = 0; value_idx < param.NumberOfValues; value_idx++) + { + if (value_array[value_idx] == val) + return TRUE; + } + } + } + return FALSE; +} + static GpStatus encode_image_wic(GpImage *image, IStream *stream, REFGUID container, GDIPCONST EncoderParameters *params) { @@ -4611,10 +4637,13 @@ static GpStatus encode_image_wic(GpImage *image, IStream *stream, if (status == Ok) status = encode_frame_wic(image->encoder, image); - /* always try to terminate, but if something already failed earlier, keep the old status. */ - terminate_status = terminate_encoder_wic(image); - if (status == Ok) - status = terminate_status; + if (!has_encoder_param_long(params, EncoderSaveFlag, EncoderValueMultiFrame)) + { + /* always try to terminate, but if something already failed earlier, keep the old status. */ + terminate_status = terminate_encoder_wic(image); + if (status == Ok) + status = terminate_status; + } return status; } @@ -4687,8 +4716,7 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream, */ GpStatus WINGDIPAPI GdipSaveAdd(GpImage *image, GDIPCONST EncoderParameters *params) { - FIXME("(%p,%p): stub\n", image, params); - return NotImplemented; + return GdipSaveAddImage(image, image, params); } /***************************************************************************** @@ -4704,8 +4732,20 @@ GpStatus WINGDIPAPI GdipSaveAdd(GpImage *image, GDIPCONST EncoderParameters *par GpStatus WINGDIPAPI GdipSaveAddImage(GpImage *image, GpImage *additional_image, GDIPCONST EncoderParameters *params) { - FIXME("(%p,%p,%p): stub\n", image, additional_image, params); - return NotImplemented; + TRACE("%p, %p, %p\n", image, additional_image, params); + + if (!image || !additional_image || !params) + return InvalidParameter; + + if (!image->encoder) + return Win32Error; + + if (has_encoder_param_long(params, EncoderSaveFlag, EncoderValueFlush)) + return terminate_encoder_wic(image); + else if (has_encoder_param_long(params, EncoderSaveFlag, EncoderValueFrameDimensionPage)) + return encode_frame_wic(image->encoder, additional_image); + else + return InvalidParameter; } /***************************************************************************** diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 01d79f08c4..bbb9365edb 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -552,41 +552,41 @@ static void test_SavingMultiPageTiff(void) /* invalid params: NULL */ stat = GdipSaveAdd(0, ¶ms); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat); stat = GdipSaveAdd((GpImage*)bm1, 0); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat); stat = GdipSaveAddImage((GpImage*)bm1, (GpImage*)bm2, 0); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat); stat = GdipSaveAddImage((GpImage*)bm1, 0, ¶ms); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat); stat = GdipSaveAddImage(0, (GpImage*)bm2, ¶ms); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat); /* win32 error: SaveAdd() can only be called after Save() with the MultiFrame param */ stat = GdipSaveAdd((GpImage*)bm1, ¶ms); - todo_wine expect(Win32Error, stat); + expect(Win32Error, stat); stat = GdipSaveAddImage((GpImage*)bm1, (GpImage*)bm2, ¶ms); - todo_wine expect(Win32Error, stat); + expect(Win32Error, stat); stat = GdipSaveImageToFile((GpImage*)bm1, filename1, &tiff_clsid, 0); /* param not set! */ expect(Ok, stat); if (stat != Ok) goto cleanup; stat = GdipSaveAdd((GpImage*)bm1, ¶ms); - todo_wine expect(Win32Error, stat); + expect(Win32Error, stat); stat = GdipSaveAddImage((GpImage*)bm1, (GpImage*)bm2, ¶ms); - todo_wine expect(Win32Error, stat); + expect(Win32Error, stat); /* win32 error: can't flush before starting the encoding process */ paramValue = EncoderValueFlush; stat = GdipSaveAdd((GpImage*)bm1, ¶ms); - todo_wine expect(Win32Error, stat); + expect(Win32Error, stat); /* win32 error: can't start encoding process through SaveAdd(), only Save() */ paramValue = EncoderValueMultiFrame; stat = GdipSaveAdd((GpImage*)bm1, ¶ms); - todo_wine expect(Win32Error, stat); + expect(Win32Error, stat); /* start encoding process: add first frame (bm1) */ paramValue = EncoderValueMultiFrame; @@ -600,7 +600,7 @@ static void test_SavingMultiPageTiff(void) /* add second frame (bm2) */ paramValue = EncoderValueFrameDimensionPage; stat = GdipSaveAddImage((GpImage*)bm1, (GpImage*)bm2, ¶ms); - todo_wine expect(Ok, stat); + expect(Ok, stat); if (stat != Ok) goto cleanup; /* finish encoding process */
1
0
0
0
Florian Will : gdiplus/tests: Add multi-page tiff file saving test.
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: 21b62920f6b55336bb666117b58c9d7bad4de763 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=21b62920f6b55336bb666117…
Author: Florian Will <florian.will(a)gmail.com> Date: Wed Feb 19 08:47:06 2020 +0100 gdiplus/tests: Add multi-page tiff file saving test. Also move the get_encoder_clsid() helper to the top of the file so it can be used by the new test. Signed-off-by: Florian Will <florian.will(a)gmail.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/tests/image.c | 244 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 214 insertions(+), 30 deletions(-) diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index d6f74050c0..01d79f08c4 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -76,6 +76,36 @@ static void expect_rawformat(REFGUID expected, GpImage *img, int line, BOOL todo expect_guid(expected, &raw, line, todo); } +static BOOL get_encoder_clsid(LPCWSTR mime, GUID *format, CLSID *clsid) +{ + GpStatus status; + UINT n_codecs, info_size, i; + ImageCodecInfo *info; + BOOL ret = FALSE; + + status = GdipGetImageEncodersSize(&n_codecs, &info_size); + expect(Ok, status); + + info = GdipAlloc(info_size); + + status = GdipGetImageEncoders(n_codecs, info_size, info); + expect(Ok, status); + + for (i = 0; i < n_codecs; i++) + { + if (!lstrcmpW(info[i].MimeType, mime)) + { + *format = info[i].FormatID; + *clsid = info[i].Clsid; + ret = TRUE; + break; + } + } + + GdipFree(info); + return ret; +} + static void test_bufferrawformat(void* buff, int size, REFGUID expected, int line, BOOL todo) { LPSTREAM stream; @@ -487,6 +517,189 @@ static void test_SavingImages(void) ok(DeleteFileA(filenameA), "Delete failed.\n"); } +static void test_SavingMultiPageTiff(void) +{ + GpStatus stat; + BOOL result; + GpBitmap *bm1 = NULL, *bm2 = NULL, *check_bm = NULL; + const REAL WIDTH = 10.0, HEIGHT = 20.0; + REAL w, h; + GUID format, tiff_clsid; + EncoderParameters params; + ULONG32 paramValue = EncoderValueFrameDimensionPage; + UINT frame_count; + static const CHAR filename1A[] = "1.tif"; + static const CHAR filename2A[] = "2.tif"; + static const WCHAR filename1[] = { '1','.','t','i','f',0 }; + static const WCHAR filename2[] = { '2','.','t','i','f',0 }; + static const WCHAR tiff_mimetype[] = { 'i','m','a','g','e','/','t','i','f','f',0 }; + + params.Count = 1; + params.Parameter[0].Guid = EncoderSaveFlag; + params.Parameter[0].Type = EncoderParameterValueTypeLong; + params.Parameter[0].NumberOfValues = 1; + params.Parameter[0].Value = ¶mValue; + + stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm1); + expect(Ok, stat); + stat = GdipCreateBitmapFromScan0(2 * WIDTH, 2 * HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm2); + expect(Ok, stat); + result = get_encoder_clsid(tiff_mimetype, &format, &tiff_clsid); + ok(result, "getting TIFF encoding clsid failed"); + + if (!bm1 || !bm2 || !result) + return; + + /* invalid params: NULL */ + stat = GdipSaveAdd(0, ¶ms); + todo_wine expect(InvalidParameter, stat); + stat = GdipSaveAdd((GpImage*)bm1, 0); + todo_wine expect(InvalidParameter, stat); + + stat = GdipSaveAddImage((GpImage*)bm1, (GpImage*)bm2, 0); + todo_wine expect(InvalidParameter, stat); + stat = GdipSaveAddImage((GpImage*)bm1, 0, ¶ms); + todo_wine expect(InvalidParameter, stat); + stat = GdipSaveAddImage(0, (GpImage*)bm2, ¶ms); + todo_wine expect(InvalidParameter, stat); + + /* win32 error: SaveAdd() can only be called after Save() with the MultiFrame param */ + stat = GdipSaveAdd((GpImage*)bm1, ¶ms); + todo_wine expect(Win32Error, stat); + stat = GdipSaveAddImage((GpImage*)bm1, (GpImage*)bm2, ¶ms); + todo_wine expect(Win32Error, stat); + + stat = GdipSaveImageToFile((GpImage*)bm1, filename1, &tiff_clsid, 0); /* param not set! */ + expect(Ok, stat); + if (stat != Ok) goto cleanup; + + stat = GdipSaveAdd((GpImage*)bm1, ¶ms); + todo_wine expect(Win32Error, stat); + stat = GdipSaveAddImage((GpImage*)bm1, (GpImage*)bm2, ¶ms); + todo_wine expect(Win32Error, stat); + + /* win32 error: can't flush before starting the encoding process */ + paramValue = EncoderValueFlush; + stat = GdipSaveAdd((GpImage*)bm1, ¶ms); + todo_wine expect(Win32Error, stat); + + /* win32 error: can't start encoding process through SaveAdd(), only Save() */ + paramValue = EncoderValueMultiFrame; + stat = GdipSaveAdd((GpImage*)bm1, ¶ms); + todo_wine expect(Win32Error, stat); + + /* start encoding process: add first frame (bm1) */ + paramValue = EncoderValueMultiFrame; + stat = GdipSaveImageToFile((GpImage*)bm1, filename1, &tiff_clsid, ¶ms); + expect(Ok, stat); + + /* re-start encoding process: add first frame (bm1), should re-create the file */ + stat = GdipSaveImageToFile((GpImage*)bm1, filename1, &tiff_clsid, ¶ms); + expect(Ok, stat); + + /* add second frame (bm2) */ + paramValue = EncoderValueFrameDimensionPage; + stat = GdipSaveAddImage((GpImage*)bm1, (GpImage*)bm2, ¶ms); + todo_wine expect(Ok, stat); + if (stat != Ok) goto cleanup; + + /* finish encoding process */ + paramValue = EncoderValueFlush; + stat = GdipSaveAdd((GpImage*)bm1, ¶ms); + expect(Ok, stat); + + /* bm1 should be unchanged, only the saved file on disk has multiple frames */ + stat = GdipImageGetFrameCount((GpImage*)bm1, &FrameDimensionPage, &frame_count); + expect(Ok, stat); + expect(1, frame_count); + + /* win32 error: encoding process already finished */ + paramValue = EncoderValueFrameDimensionPage; + stat = GdipSaveAddImage((GpImage*)bm1, (GpImage*)bm2, ¶ms); + expect(Win32Error, stat); + + stat = GdipSaveAdd((GpImage*)bm1, ¶ms); + expect(Win32Error, stat); + + GdipDisposeImage((GpImage*)bm1); + bm1 = 0; + GdipDisposeImage((GpImage*)bm2); + bm2 = 0; + + /* re-load and check image stats */ + stat = GdipLoadImageFromFile(filename1, (GpImage**)&check_bm); + expect(Ok, stat); + + stat = GdipImageGetFrameCount((GpImage*)check_bm, &FrameDimensionPage, &frame_count); + expect(Ok, stat); + expect(2, frame_count); + if (stat != Ok || frame_count != 2) goto cleanup; + + stat = GdipGetImageDimension((GpImage*)check_bm, &w, &h); + expect(Ok, stat); + expectf(WIDTH, w); /* frame index 0: bm1 stats */ + expectf(HEIGHT, h); + + stat = GdipImageSelectActiveFrame((GpImage*)check_bm, &FrameDimensionPage, 1); + expect(Ok, stat); + + stat = GdipGetImageDimension((GpImage*)check_bm, &w, &h); + expectf(2 * WIDTH, w); /* frame index 1: bm2 stats */ + expectf(2 * HEIGHT, h); + + /* now proper API use for SaveAdd() to swap the frames in check_bm */ + paramValue = EncoderValueMultiFrame; + stat = GdipSaveImageToFile((GpImage*)check_bm, filename2, &tiff_clsid, ¶ms); + expect(Ok, stat); /* second frame is active: bm2 */ + + stat = GdipImageSelectActiveFrame((GpImage*)check_bm, &FrameDimensionPage, 0); + expect(Ok, stat); + + paramValue = EncoderValueFrameDimensionPage; + stat = GdipSaveAdd((GpImage*)check_bm, ¶ms); + expect(Ok, stat); /* first frame is active: bm1 */ + + paramValue = EncoderValueFlush; + stat = GdipSaveAdd((GpImage*)check_bm, ¶ms); + expect(Ok, stat); /* flushed encoder (finished encoding process) */ + + GdipDisposeImage((GpImage*)check_bm); + check_bm = 0; + + /* re-load and check image stats */ + stat = GdipLoadImageFromFile(filename2, (GpImage**)&check_bm); + expect(Ok, stat); + + stat = GdipImageGetFrameCount((GpImage*)check_bm, &FrameDimensionPage, &frame_count); + expect(Ok, stat); + expect(2, frame_count); + + stat = GdipGetImageDimension((GpImage*)check_bm, &w, &h); + expect(Ok, stat); + expectf(2 * WIDTH, w); /* frame index 0: bm2 stats */ + expectf(2 * HEIGHT, h); + + stat = GdipImageSelectActiveFrame((GpImage*)check_bm, &FrameDimensionPage, 1); + expect(Ok, stat); + + stat = GdipGetImageDimension((GpImage*)check_bm, &w, &h); + expectf(WIDTH, w); /* frame index 1: bm1 stats */ + expectf(HEIGHT, h); + + cleanup: + if (bm1) + GdipDisposeImage((GpImage*)bm1); + if (bm2) + GdipDisposeImage((GpImage*)bm2); + ok(DeleteFileA(filename1A), "Delete 1.tif failed.\n"); + + if (check_bm) + { + GdipDisposeImage((GpImage*)check_bm); + ok(DeleteFileA(filename2A), "Delete 2.tif failed.\n"); + } +} + static void test_encoders(void) { GpStatus stat; @@ -4888,36 +5101,6 @@ static void test_CloneBitmapArea(void) GdipDisposeImage((GpImage *)bitmap); } -static BOOL get_encoder_clsid(LPCWSTR mime, GUID *format, CLSID *clsid) -{ - GpStatus status; - UINT n_codecs, info_size, i; - ImageCodecInfo *info; - BOOL ret = FALSE; - - status = GdipGetImageEncodersSize(&n_codecs, &info_size); - expect(Ok, status); - - info = GdipAlloc(info_size); - - status = GdipGetImageEncoders(n_codecs, info_size, info); - expect(Ok, status); - - for (i = 0; i < n_codecs; i++) - { - if (!lstrcmpW(info[i].MimeType, mime)) - { - *format = info[i].FormatID; - *clsid = info[i].Clsid; - ret = TRUE; - break; - } - } - - GdipFree(info); - return ret; -} - static void test_supported_encoders(void) { static const WCHAR bmp_mimetype[] = { 'i', 'm', 'a','g', 'e', '/', 'b', 'm', 'p',0 }; @@ -5700,6 +5883,7 @@ START_TEST(image) test_GdipImageGetFrameDimensionsCount(); test_LoadingImages(); test_SavingImages(); + test_SavingMultiPageTiff(); test_encoders(); test_LockBits(); test_LockBits_UserBuf();
1
0
0
0
Florian Will : gdiplus: Add GdipSaveAddImage() stub.
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: 483aaf33085db4e2f0d900f9871e1aae2fecccd3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=483aaf33085db4e2f0d900f9…
Author: Florian Will <florian.will(a)gmail.com> Date: Wed Feb 19 08:47:05 2020 +0100 gdiplus: Add GdipSaveAddImage() stub. Also update the GdipSaveAdd() stub to return NotImplemented instead of silently failing. Signed-off-by: Florian Will <florian.will(a)gmail.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/image.c | 22 +++++++++++++++++++++- include/gdiplusflat.h | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 11866633b3..43dc0a82d2 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -472,7 +472,7 @@ 472 stdcall GdipRotateTextureTransform(ptr float long) 473 stdcall GdipRotateWorldTransform(ptr float long) 474 stdcall GdipSaveAdd(ptr ptr) -475 stub GdipSaveAddImage +475 stdcall GdipSaveAddImage(ptr ptr ptr) 476 stdcall GdipSaveGraphics(ptr ptr) 477 stdcall GdipSaveImageToFile(ptr wstr ptr ptr) 478 stdcall GdipSaveImageToStream(ptr ptr ptr ptr) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 6fee7c3854..94c03ede19 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -4681,11 +4681,31 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream, /***************************************************************************** * GdipSaveAdd [GDIPLUS.@] + * + * Like GdipSaveAddImage(), but encode the currently active frame of the given image into the file + * or stream that is currently being encoded. */ GpStatus WINGDIPAPI GdipSaveAdd(GpImage *image, GDIPCONST EncoderParameters *params) { FIXME("(%p,%p): stub\n", image, params); - return Ok; + return NotImplemented; +} + +/***************************************************************************** + * GdipSaveAddImage [GDIPLUS.@] + * + * Encode the currently active frame of additional_image into the file or stream that is currently + * being encoded by the image given in the image parameter. The first frame of a multi-frame image + * must be encoded using the normal GdipSaveImageToStream() or GdipSaveImageToFile() functions, + * but with the "MultiFrame" encoding parameter set. The multi-frame encoding process must be + * finished after adding the last frame by calling GdipSaveAdd() with the "Flush" encoding parameter + * set. + */ +GpStatus WINGDIPAPI GdipSaveAddImage(GpImage *image, GpImage *additional_image, + GDIPCONST EncoderParameters *params) +{ + FIXME("(%p,%p,%p): stub\n", image, additional_image, params); + return NotImplemented; } /***************************************************************************** diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 1e26c0a9d5..ed0f498483 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -433,6 +433,8 @@ GpStatus WINGDIPAPI GdipRemovePropertyItem(GpImage*,PROPID); GpStatus WINGDIPAPI GdipSaveImageToFile(GpImage*,GDIPCONST WCHAR*,GDIPCONST CLSID*,GDIPCONST EncoderParameters*); GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage*,IStream*, GDIPCONST CLSID*,GDIPCONST EncoderParameters*); +GpStatus WINGDIPAPI GdipSaveAdd(GpImage*,GDIPCONST EncoderParameters*); +GpStatus WINGDIPAPI GdipSaveAddImage(GpImage*,GpImage*,GDIPCONST EncoderParameters*); GpStatus WINGDIPAPI GdipSetImagePalette(GpImage*,GDIPCONST ColorPalette*); GpStatus WINGDIPAPI GdipSetPropertyItem(GpImage*,GDIPCONST PropertyItem*);
1
0
0
0
Florian Will : include: Add enums and GUID required for GdipSaveAdd().
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: cc0d5c4fc96a37aa3c6c9242e9c5cab91638d59b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cc0d5c4fc96a37aa3c6c9242…
Author: Florian Will <florian.will(a)gmail.com> Date: Wed Feb 19 08:47:04 2020 +0100 include: Add enums and GUID required for GdipSaveAdd(). Signed-off-by: Florian Will <florian.will(a)gmail.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/gdiplusenums.h | 41 +++++++++++++++++++++++++++++++++++++++++ include/gdiplusimaging.h | 2 ++ 2 files changed, 43 insertions(+) diff --git a/include/gdiplusenums.h b/include/gdiplusenums.h index 905a87a451..0fcc11d4b9 100644 --- a/include/gdiplusenums.h +++ b/include/gdiplusenums.h @@ -336,6 +336,45 @@ enum ImageFlags ImageFlagsCaching = 0x00020000 }; +enum EncoderParameterValueType { + EncoderParameterValueTypeByte = 1, + EncoderParameterValueTypeASCII = 2, + EncoderParameterValueTypeShort = 3, + EncoderParameterValueTypeLong = 4, + EncoderParameterValueTypeRational = 5, + EncoderParameterValueTypeLongRange = 6, + EncoderParameterValueTypeUndefined = 7, + EncoderParameterValueTypeRationalRange = 8, + EncoderParameterValueTypePointer = 9 +}; + +enum EncoderValue { + EncoderValueColorTypeCMYK = 0, + EncoderValueColorTypeYCCK = 1, + EncoderValueCompressionLZW = 2, + EncoderValueCompressionCCITT3 = 3, + EncoderValueCompressionCCITT4 = 4, + EncoderValueCompressionRle = 5, + EncoderValueCompressionNone = 6, + EncoderValueScanMethodInterlaced = 7, + EncoderValueScanMethodNonInterlaced = 8, + EncoderValueVersionGif87 = 9, + EncoderValueVersionGif89 = 10, + EncoderValueRenderProgressive = 11, + EncoderValueRenderNonProgressive = 12, + EncoderValueTransformRotate90 = 13, + EncoderValueTransformRotate180 = 14, + EncoderValueTransformRotate270 = 15, + EncoderValueTransformFlipHorizontal = 16, + EncoderValueTransformFlipVertical = 17, + EncoderValueMultiFrame = 18, + EncoderValueLastFrame = 19, + EncoderValueFlush = 20, + EncoderValueFrameDimensionTime = 21, + EncoderValueFrameDimensionResolution = 22, + EncoderValueFrameDimensionPage = 23 +}; + enum CombineMode { CombineModeReplace, @@ -747,6 +786,8 @@ typedef enum HotkeyPrefix HotkeyPrefix; typedef enum PenAlignment PenAlignment; typedef enum PaletteFlags PaletteFlags; typedef enum ImageCodecFlags ImageCodecFlags; +typedef enum EncoderParameterValueType EncoderParameterValueType; +typedef enum EncoderValue EncoderValue; typedef enum CombineMode CombineMode; typedef enum FlushIntention FlushIntention; typedef enum CoordinateSpace CoordinateSpace; diff --git a/include/gdiplusimaging.h b/include/gdiplusimaging.h index 93114d95c4..9e6b58283f 100644 --- a/include/gdiplusimaging.h +++ b/include/gdiplusimaging.h @@ -35,6 +35,8 @@ DEFINE_GUID(FrameDimensionTime, 0x6aedbd6d, 0x3fb5, 0x418a, 0x83, 0xa6, 0x DEFINE_GUID(FrameDimensionPage, 0x7462dc86, 0x6180, 0x4c7e, 0x8e, 0x3f, 0xee, 0x73, 0x33, 0xa7, 0xa4, 0x83); DEFINE_GUID(FrameDimensionResolution, 0x84236f7b, 0x3bd3, 0x428f, 0x8d, 0xab, 0x4e, 0xa1, 0x43, 0x9c, 0xa3, 0x15); +DEFINE_GUID(EncoderSaveFlag, 0x292266fc, 0xac40, 0x47bf, 0x8c, 0xfc, 0xa8, 0x5b, 0x89, 0xa6, 0x55, 0xde); + enum ImageLockMode { ImageLockModeRead = 1,
1
0
0
0
Florian Will : gdiplus: Refactor to split up encode_image_wic().
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: b31fc788122c1b47b9a9f20e4578fb08e02507e1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b31fc788122c1b47b9a9f20e…
Author: Florian Will <florian.will(a)gmail.com> Date: Wed Feb 19 08:47:03 2020 +0100 gdiplus: Refactor to split up encode_image_wic(). New functions initialize_encoder_wic(), encode_frame_wic() and terminate_encoder_wic() are useful for implementing GdipSaveAdd() and GdipSaveAddImage() later. The WIC encoder is now stored in the new GpImage "encoder" field instead of a local variable. This makes it possible to keep the encoder active between multiple gdiplus API calls, which is also useful for GdipSaveAdd() and GdipSaveAddImage(). Signed-off-by: Florian Will <florian.will(a)gmail.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/gdiplus_private.h | 2 + dlls/gdiplus/image.c | 93 ++++++++++++++++++++++++++++++++---------- 2 files changed, 73 insertions(+), 22 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 8c4fcceded..39caf1a91e 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -72,6 +72,7 @@ extern GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace ds extern GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics) DECLSPEC_HIDDEN; extern GpStatus encode_image_png(GpImage *image, IStream* stream, GDIPCONST EncoderParameters* params) DECLSPEC_HIDDEN; +extern GpStatus terminate_encoder_wic(GpImage *image) DECLSPEC_HIDDEN; extern GpStatus METAFILE_GetGraphicsContext(GpMetafile* metafile, GpGraphics **result) DECLSPEC_HIDDEN; extern GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc) DECLSPEC_HIDDEN; @@ -346,6 +347,7 @@ struct GpAdjustableArrowCap{ struct GpImage{ IWICBitmapDecoder *decoder; + IWICBitmapEncoder *encoder; ImageType type; GUID format; UINT flags; diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index dcdc49c6d6..6fee7c3854 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -1827,6 +1827,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, (*bitmap)->height = height; (*bitmap)->format = format; (*bitmap)->image.decoder = NULL; + (*bitmap)->image.encoder = NULL; (*bitmap)->hbitmap = hbitmap; (*bitmap)->hdc = NULL; (*bitmap)->bits = bits; @@ -2046,6 +2047,8 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette) if (dst->image.decoder) IWICBitmapDecoder_Release(dst->image.decoder); dst->image.decoder = src->image.decoder; + terminate_encoder_wic(&dst->image); /* terminate active encoder before overwriting with src */ + dst->image.encoder = src->image.encoder; dst->image.frame_count = src->image.frame_count; dst->image.current_frame = src->image.current_frame; dst->image.format = src->image.format; @@ -2078,6 +2081,7 @@ static GpStatus free_image_data(GpImage *image) } if (image->decoder) IWICBitmapDecoder_Release(image->decoder); + terminate_encoder_wic(image); heap_free(image->palette); return Ok; @@ -3744,6 +3748,8 @@ static GpStatus select_frame_wic(GpImage *image, UINT active_frame) new_image->busy = image->busy; memcpy(&new_image->format, &image->format, sizeof(GUID)); + new_image->encoder = image->encoder; + image->encoder = NULL; free_image_data(image); if (image->type == ImageTypeBitmap) *(GpBitmap *)image = *(GpBitmap *)new_image; @@ -4435,13 +4441,52 @@ GpStatus WINGDIPAPI GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filenam * These functions encode an image in different image file formats. */ -static GpStatus encode_image_wic(GpImage *image, IStream* stream, - REFGUID container, GDIPCONST EncoderParameters* params) +static GpStatus initialize_encoder_wic(IStream *stream, REFGUID container, GpImage *image) +{ + IWICImagingFactory *factory; + HRESULT hr; + + TRACE("%p,%s\n", stream, wine_dbgstr_guid(container)); + + terminate_encoder_wic(image); /* terminate previous encoder if it exists */ + + hr = WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory); + if (FAILED(hr)) return hresult_to_status(hr); + hr = IWICImagingFactory_CreateEncoder(factory, container, NULL, &image->encoder); + IWICImagingFactory_Release(factory); + if (FAILED(hr)) + { + image->encoder = NULL; + return hresult_to_status(hr); + } + + hr = IWICBitmapEncoder_Initialize(image->encoder, stream, WICBitmapEncoderNoCache); + if (FAILED(hr)) + { + IWICBitmapEncoder_Release(image->encoder); + image->encoder = NULL; + return hresult_to_status(hr); + } + return Ok; +} + +GpStatus terminate_encoder_wic(GpImage *image) +{ + if (!image->encoder) + return Ok; + else + { + HRESULT hr = IWICBitmapEncoder_Commit(image->encoder); + IWICBitmapEncoder_Release(image->encoder); + image->encoder = NULL; + return hresult_to_status(hr); + } +} + +static GpStatus encode_frame_wic(IWICBitmapEncoder *encoder, GpImage *image) { GpStatus stat; GpBitmap *bitmap; - IWICImagingFactory *factory; - IWICBitmapEncoder *encoder; IWICBitmapFrameEncode *frameencode; IPropertyBag2 *encoderoptions; HRESULT hr; @@ -4466,20 +4511,7 @@ static GpStatus encode_image_wic(GpImage *image, IStream* stream, rc.Width = width; rc.Height = height; - hr = WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory); - if (FAILED(hr)) - return hresult_to_status(hr); - hr = IWICImagingFactory_CreateEncoder(factory, container, NULL, &encoder); - IWICImagingFactory_Release(factory); - if (FAILED(hr)) - return hresult_to_status(hr); - - hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache); - - if (SUCCEEDED(hr)) - { - hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, &encoderoptions); - } + hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, &encoderoptions); if (SUCCEEDED(hr)) /* created frame */ { @@ -4563,13 +4595,30 @@ static GpStatus encode_image_wic(GpImage *image, IStream* stream, IPropertyBag2_Release(encoderoptions); } - if (SUCCEEDED(hr)) - hr = IWICBitmapEncoder_Commit(encoder); - - IWICBitmapEncoder_Release(encoder); return hresult_to_status(hr); } +static GpStatus encode_image_wic(GpImage *image, IStream *stream, + REFGUID container, GDIPCONST EncoderParameters *params) +{ + GpStatus status, terminate_status; + + if (image->type != ImageTypeBitmap) + return GenericError; + + status = initialize_encoder_wic(stream, container, image); + + if (status == Ok) + status = encode_frame_wic(image->encoder, image); + + /* always try to terminate, but if something already failed earlier, keep the old status. */ + terminate_status = terminate_encoder_wic(image); + if (status == Ok) + status = terminate_status; + + return status; +} + static GpStatus encode_image_BMP(GpImage *image, IStream* stream, GDIPCONST EncoderParameters* params) {
1
0
0
0
Jeff Smith : gdiplus: Add LineCapDiamondAnchor path widening.
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: bc49309fe27f832301f36b2c3b6a8d530940c37f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bc49309fe27f832301f36b2c…
Author: Jeff Smith <whydoubt(a)gmail.com> Date: Tue Feb 18 23:52:01 2020 -0600 gdiplus: Add LineCapDiamondAnchor path widening. Signed-off-by: Jeff Smith <whydoubt(a)gmail.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/graphicspath.c | 28 ++++++++++++++++++++++++++-- dlls/gdiplus/tests/graphicspath.c | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 79d99a3eb4..249f584089 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -2068,6 +2068,30 @@ static void add_anchor(const GpPointF *endpoint, const GpPointF *nextpoint, break; } + case LineCapDiamondAnchor: + { + REAL segment_dy = nextpoint->Y-endpoint->Y; + REAL segment_dx = nextpoint->X-endpoint->X; + REAL segment_length = sqrtf(segment_dy*segment_dy + segment_dx*segment_dx); + REAL par_dx, par_dy; + REAL perp_dx, perp_dy; + + par_dx = -pen->width * segment_dx / segment_length; + par_dy = -pen->width * segment_dy / segment_length; + + perp_dx = -pen->width * segment_dy / segment_length; + perp_dy = pen->width * segment_dx / segment_length; + + *last_point = add_path_list_node(*last_point, endpoint->X + par_dx, + endpoint->Y + par_dy, PathPointTypeStart); + *last_point = add_path_list_node(*last_point, endpoint->X - perp_dx, + endpoint->Y - perp_dy, PathPointTypeLine); + *last_point = add_path_list_node(*last_point, endpoint->X - par_dx, + endpoint->Y - par_dy, PathPointTypeLine); + *last_point = add_path_list_node(*last_point, endpoint->X + perp_dx, + endpoint->Y + perp_dy, PathPointTypeLine); + break; + } } (*last_point)->type |= PathPointTypeCloseSubpath; @@ -2323,10 +2347,10 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, { last_point = points; - if (pen->endcap > LineCapRoundAnchor) + if (pen->endcap > LineCapDiamondAnchor) FIXME("unimplemented end cap %x\n", pen->endcap); - if (pen->startcap > LineCapRoundAnchor) + if (pen->startcap > LineCapDiamondAnchor) FIXME("unimplemented start cap %x\n", pen->startcap); if (pen->dashcap != DashCapFlat) diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 6acfddd53e..aabacef3aa 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -1389,7 +1389,7 @@ static void test_widen_cap(void) { LineCapRoundAnchor, widenline_caproundanchor_path, ARRAY_SIZE(widenline_caproundanchor_path) }, { LineCapDiamondAnchor, widenline_capdiamondanchor_path, - ARRAY_SIZE(widenline_capdiamondanchor_path), TRUE }, + ARRAY_SIZE(widenline_capdiamondanchor_path) }, { LineCapArrowAnchor, widenline_caparrowanchor_path, ARRAY_SIZE(widenline_caparrowanchor_path), TRUE }, };
1
0
0
0
Jeff Smith : gdiplus: Add LineCapRoundAnchor path widening.
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: 8e7c320df699c5d0f6d724048738599dfbef5839 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8e7c320df699c5d0f6d72404…
Author: Jeff Smith <whydoubt(a)gmail.com> Date: Tue Feb 18 23:52:00 2020 -0600 gdiplus: Add LineCapRoundAnchor path widening. Signed-off-by: Jeff Smith <whydoubt(a)gmail.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/graphicspath.c | 56 +++++++++++++++++++++++++++++++++++++-- dlls/gdiplus/tests/graphicspath.c | 2 +- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index fcb2ed0b9e..79d99a3eb4 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -2016,6 +2016,58 @@ static void add_anchor(const GpPointF *endpoint, const GpPointF *nextpoint, endpoint->Y + par_dy - perp_dy, PathPointTypeLine); break; } + case LineCapRoundAnchor: + { + REAL segment_dy = nextpoint->Y-endpoint->Y; + REAL segment_dx = nextpoint->X-endpoint->X; + REAL segment_length = sqrtf(segment_dy*segment_dy + segment_dx*segment_dx); + REAL dx, dy, dx2, dy2; + const REAL control_point_distance = 0.55228475; /* 4/3 * (sqrt(2) - 1) */ + + dx = -pen->width * segment_dx / segment_length; + dy = -pen->width * segment_dy / segment_length; + + dx2 = dx * control_point_distance; + dy2 = dy * control_point_distance; + + /* starting point */ + *last_point = add_path_list_node(*last_point, endpoint->X + dy, + endpoint->Y - dx, PathPointTypeStart); + + /* first 90-degree arc */ + *last_point = add_path_list_node(*last_point, endpoint->X + dy + dx2, + endpoint->Y - dx + dy2, PathPointTypeBezier); + *last_point = add_path_list_node(*last_point, endpoint->X + dx + dy2, + endpoint->Y + dy - dx2, PathPointTypeBezier); + *last_point = add_path_list_node(*last_point, endpoint->X + dx, + endpoint->Y + dy, PathPointTypeBezier); + + /* second 90-degree arc */ + *last_point = add_path_list_node(*last_point, endpoint->X + dx - dy2, + endpoint->Y + dy + dx2, PathPointTypeBezier); + *last_point = add_path_list_node(*last_point, endpoint->X - dy + dx2, + endpoint->Y + dx + dy2, PathPointTypeBezier); + *last_point = add_path_list_node(*last_point, endpoint->X - dy, + endpoint->Y + dx, PathPointTypeBezier); + + /* third 90-degree arc */ + *last_point = add_path_list_node(*last_point, endpoint->X - dy - dx2, + endpoint->Y + dx - dy2, PathPointTypeBezier); + *last_point = add_path_list_node(*last_point, endpoint->X - dx - dy2, + endpoint->Y - dy + dx2, PathPointTypeBezier); + *last_point = add_path_list_node(*last_point, endpoint->X - dx, + endpoint->Y - dy, PathPointTypeBezier); + + /* fourth 90-degree arc */ + *last_point = add_path_list_node(*last_point, endpoint->X - dx + dy2, + endpoint->Y - dy - dx2, PathPointTypeBezier); + *last_point = add_path_list_node(*last_point, endpoint->X + dy - dx2, + endpoint->Y - dx - dy2, PathPointTypeBezier); + *last_point = add_path_list_node(*last_point, endpoint->X + dy, + endpoint->Y - dx, PathPointTypeBezier); + + break; + } } (*last_point)->type |= PathPointTypeCloseSubpath; @@ -2271,10 +2323,10 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, { last_point = points; - if (pen->endcap > LineCapSquareAnchor) + if (pen->endcap > LineCapRoundAnchor) FIXME("unimplemented end cap %x\n", pen->endcap); - if (pen->startcap > LineCapSquareAnchor) + if (pen->startcap > LineCapRoundAnchor) FIXME("unimplemented start cap %x\n", pen->startcap); if (pen->dashcap != DashCapFlat) diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 9ce95a2c74..6acfddd53e 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -1387,7 +1387,7 @@ static void test_widen_cap(void) { LineCapSquareAnchor, widenline_capsquareanchor_path, ARRAY_SIZE(widenline_capsquareanchor_path) }, { LineCapRoundAnchor, widenline_caproundanchor_path, - ARRAY_SIZE(widenline_caproundanchor_path), TRUE }, + ARRAY_SIZE(widenline_caproundanchor_path) }, { LineCapDiamondAnchor, widenline_capdiamondanchor_path, ARRAY_SIZE(widenline_capdiamondanchor_path), TRUE }, { LineCapArrowAnchor, widenline_caparrowanchor_path,
1
0
0
0
Jeff Smith : gdiplus: Add LineCapSquareAnchor path widening.
by Alexandre Julliard
19 Feb '20
19 Feb '20
Module: wine Branch: master Commit: 1da5cd6a8ff89742a506a52ea785216c73844529 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1da5cd6a8ff89742a506a52e…
Author: Jeff Smith <whydoubt(a)gmail.com> Date: Tue Feb 18 23:51:59 2020 -0600 gdiplus: Add LineCapSquareAnchor path widening. Signed-off-by: Jeff Smith <whydoubt(a)gmail.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/graphicspath.c | 50 +++++++++++++++++++++++++++++++++++++-- dlls/gdiplus/tests/graphicspath.c | 2 +- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 96078c3da9..fcb2ed0b9e 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1983,6 +1983,44 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint, } } +static void add_anchor(const GpPointF *endpoint, const GpPointF *nextpoint, + GpPen *pen, GpLineCap cap, GpCustomLineCap *custom, path_list_node_t **last_point) +{ + switch (cap) + { + default: + case LineCapNoAnchor: + return; + case LineCapSquareAnchor: + { + REAL segment_dy = nextpoint->Y-endpoint->Y; + REAL segment_dx = nextpoint->X-endpoint->X; + REAL segment_length = sqrtf(segment_dy*segment_dy + segment_dx*segment_dx); + REAL distance = pen->width / sqrtf(2.0); + REAL par_dx, par_dy; + REAL perp_dx, perp_dy; + + par_dx = -distance * segment_dx / segment_length; + par_dy = -distance * segment_dy / segment_length; + + perp_dx = -distance * segment_dy / segment_length; + perp_dy = distance * segment_dx / segment_length; + + *last_point = add_path_list_node(*last_point, endpoint->X - par_dx - perp_dx, + endpoint->Y - par_dy - perp_dy, PathPointTypeStart); + *last_point = add_path_list_node(*last_point, endpoint->X - par_dx + perp_dx, + endpoint->Y - par_dy + perp_dy, PathPointTypeLine); + *last_point = add_path_list_node(*last_point, endpoint->X + par_dx + perp_dx, + endpoint->Y + par_dy + perp_dy, PathPointTypeLine); + *last_point = add_path_list_node(*last_point, endpoint->X + par_dx - perp_dx, + endpoint->Y + par_dy - perp_dy, PathPointTypeLine); + break; + } + } + + (*last_point)->type |= PathPointTypeCloseSubpath; +} + static void widen_open_figure(const GpPointF *points, GpPen *pen, int start, int end, GpLineCap start_cap, GpCustomLineCap *start_custom, GpLineCap end_cap, GpCustomLineCap *end_custom, path_list_node_t **last_point) @@ -2014,6 +2052,14 @@ static void widen_open_figure(const GpPointF *points, GpPen *pen, int start, int prev_point->next->type = PathPointTypeStart; (*last_point)->type |= PathPointTypeCloseSubpath; + + if (start_cap & LineCapAnchorMask) + add_anchor(&points[start], &points[start+1], + pen, start_cap, start_custom, last_point); + + if (end_cap & LineCapAnchorMask) + add_anchor(&points[end], &points[end-1], + pen, end_cap, end_custom, last_point); } static void widen_closed_figure(GpPath *path, GpPen *pen, int start, int end, @@ -2225,10 +2271,10 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, { last_point = points; - if (pen->endcap > LineCapTriangle) + if (pen->endcap > LineCapSquareAnchor) FIXME("unimplemented end cap %x\n", pen->endcap); - if (pen->startcap > LineCapTriangle) + if (pen->startcap > LineCapSquareAnchor) FIXME("unimplemented start cap %x\n", pen->startcap); if (pen->dashcap != DashCapFlat) diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index b840801739..9ce95a2c74 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -1385,7 +1385,7 @@ static void test_widen_cap(void) { LineCapNoAnchor, widenline_capflat_path, ARRAY_SIZE(widenline_capflat_path) }, { LineCapSquareAnchor, widenline_capsquareanchor_path, - ARRAY_SIZE(widenline_capsquareanchor_path), TRUE }, + ARRAY_SIZE(widenline_capsquareanchor_path) }, { LineCapRoundAnchor, widenline_caproundanchor_path, ARRAY_SIZE(widenline_caproundanchor_path), TRUE }, { LineCapDiamondAnchor, widenline_capdiamondanchor_path,
1
0
0
0
← Newer
1
...
26
27
28
29
30
31
32
...
88
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
Results per page:
10
25
50
100
200