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
December 2012
----- 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
549 discussions
Start a n
N
ew thread
Jacek Caban : itss: Cleaned up CombineUrl tests.
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: fa53a8ccefef1ba2df1cb561abe1a86d9c46f368 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fa53a8ccefef1ba2df1cb561a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Dec 5 18:38:28 2012 +0100 itss: Cleaned up CombineUrl tests. --- dlls/itss/tests/protocol.c | 104 ++++++++++++++++++-------------------------- 1 files changed, 43 insertions(+), 61 deletions(-) diff --git a/dlls/itss/tests/protocol.c b/dlls/itss/tests/protocol.c index 7467d37..133a8bf 100644 --- a/dlls/itss/tests/protocol.c +++ b/dlls/itss/tests/protocol.c @@ -103,6 +103,24 @@ static const WCHAR cache_file3[] = {'t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l','/',0}; static const WCHAR *cache_file = cache_file1; +static const WCHAR *a2w(const char *str) +{ + static WCHAR bufs[8][128]; + static int i; + + if(!str) + return NULL; + + i = (i+1) % 8; + MultiByteToWideChar(CP_ACP, 0, str, -1, bufs[i], 128); + return bufs[i]; +} + +static int strcmp_wa(const WCHAR *str1, const char *str2) +{ + return lstrcmpW(str1, a2w(str2)); +} + static HRESULT WINAPI ProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv) { if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocolSink, riid)) { @@ -442,65 +460,29 @@ static void test_protocol_url(IClassFactory *factory, LPCWSTR url, BOOL expect_m read_protocol = NULL; } -static const WCHAR rel_url1[] = - {'t','e','s','t','.','h','t','m','l',0}; -static const WCHAR rel_url2[] = - {'t','e','s','t','.','c','h','m',':',':','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR rel_url3[] = - {'/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR rel_url4[] = - {'t','e',':','t','.','h','t','m','l',0}; -static const WCHAR rel_url5[] = - {'d','i','r','/','t','e','s','t','.','h','t','m','l',0}; - -static const WCHAR base_url1[] = {'i','t','s',':', - 't','e','s','t',':','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0}; -static const WCHAR base_url2[] = {'i','t','s',':','t','e','s','t','.','c','h','m', - ':',':','/','d','i','r','/','b','l','a','n','k','.','h','t','m','l',0}; -static const WCHAR base_url3[] = {'m','s','-','i','t','s',':','t','e','s','t','.','c','h','m', - ':',':','/','d','i','r','/','b','l','a','n','k','.','h','t','m','l',0}; -static const WCHAR base_url4[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':', - 't','e','s','t','.','c','h','m',':',':','/','d','i','r','/', - 'b','l','a','n','k','.','h','t','m','l',0}; -static const WCHAR base_url5[] = {'x','x','x',':','t','e','s','t','.','c','h','m', - ':',':','/','d','i','r','/','b','l','a','n','k','.','h','t','m','l',0}; - -static const WCHAR combined_url1[] = {'i','t','s',':', - 't','e','s','t','.','c','h','m',':',':','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url2[] = {'i','t','s',':', - 't','e','s','t','.','c','h','m',':',':','/','d','i','r','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url3[] = {'i','t','s',':', - 't','e','s','t',':','.','c','h','m',':',':','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url4[] = {'i','t','s',':','t','e','s','t','.','c','h','m', - ':',':','b','l','a','n','k','.','h','t','m','l','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url5[] = {'m','s','-','i','t','s',':', - 't','e','s','t','.','c','h','m',':',':','/','d','i','r','/','t','e','s','t','.','h','t','m','l',0}; -static const WCHAR combined_url6[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':', - 't','e','s','t','.','c','h','m',':',':','/','d','i','r','/','t','e','s','t','.','h','t','m','l',0}; - static const struct { - LPCWSTR base_url; - LPCWSTR rel_url; + const char *base_url; + const char *rel_url; DWORD flags; HRESULT hres; - LPCWSTR combined_url; + const char *combined_url; } combine_tests[] = { - {blank_url1, blank_url1, 0, STG_E_INVALIDNAME, NULL}, - {blank_url2, blank_url2, 0, STG_E_INVALIDNAME, NULL}, - {blank_url1, rel_url1, 0, S_OK, combined_url1}, - {blank_url1, rel_url2, 0, STG_E_INVALIDNAME, NULL}, - {blank_url1, rel_url3, 0, S_OK, combined_url1}, - {blank_url1, rel_url4, 0, STG_E_INVALIDNAME, NULL}, - {blank_url1, rel_url3, URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO, S_OK, combined_url1}, - {blank_url1, rel_url5, 0, S_OK, combined_url2}, - {rel_url1, rel_url2, 0, 0x80041001, NULL}, - {base_url1, rel_url1, 0, S_OK, combined_url3}, - {base_url2, rel_url1, 0, S_OK, combined_url2}, - {blank_url4, rel_url1, 0, S_OK, combined_url4}, - {base_url3, rel_url1, 0, S_OK, combined_url5}, - {base_url4, rel_url1, 0, S_OK, combined_url6}, - {base_url5, rel_url1, 0, INET_E_USE_DEFAULT_PROTOCOLHANDLER, NULL}, - {base_url2, rel_url3, 0, S_OK, combined_url1}, + {"its:test.chm::/blank.html", "its:test.chm::/blank.html", 0, STG_E_INVALIDNAME, NULL}, + {"mS-iTs:test.chm::/blank.html", "mS-iTs:test.chm::/blank.html", 0, STG_E_INVALIDNAME, NULL}, + {"its:test.chm::/blank.html", "test.html", 0, S_OK, "its:test.chm::/test.html"}, + {"its:test.chm::/blank.html", "test.chm::/test.html", 0, STG_E_INVALIDNAME, NULL}, + {"its:test.chm::/blank.html", "/test.html", 0, S_OK, "its:test.chm::/test.html"}, + {"its:test.chm::/blank.html", "te:t.html", 0, STG_E_INVALIDNAME, NULL}, + {"its:test.chm::/blank.html", "/test.html", URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO, S_OK, "its:test.chm::/test.html"}, + {"its:test.chm::/blank.html", "dir/test.html", 0, S_OK, "its:test.chm::/dir/test.html"}, + {"test.html", "test.chm::/test.html", 0, 0x80041001, NULL}, + {"its:test:.chm::/blank.html", "test.html", 0, S_OK, "its:test:.chm::/test.html"}, + {"its:test.chm::/dir/blank.html", "test.html", 0, S_OK, "its:test.chm::/dir/test.html"}, + {"its:test.chm::blank.html", "test.html", 0, S_OK, "its:test.chm::blank.htmltest.html"}, + {"ms-its:test.chm::/dir/blank.html", "test.html", 0, S_OK, "ms-its:test.chm::/dir/test.html"}, + {"mk:@MSITStore:test.chm::/dir/blank.html", "test.html", 0, S_OK, "mk:@MSITStore:test.chm::/dir/test.html"}, + {"xxx:test.chm::/dir/blank.html", "test.html", 0, INET_E_USE_DEFAULT_PROTOCOLHANDLER, NULL}, + {"its:test.chm::/dir/blank.html", "/test.html", 0, S_OK, "its:test.chm::/test.html"}, }; static void test_its_protocol_info(IInternetProtocol *protocol) @@ -527,25 +509,25 @@ static void test_its_protocol_info(IInternetProtocol *protocol) for(i=0; i < sizeof(combine_tests)/sizeof(combine_tests[0]); i++) { size = 0xdeadbeef; memset(buf, 0xfe, sizeof(buf)); - hres = IInternetProtocolInfo_CombineUrl(info, combine_tests[i].base_url, - combine_tests[i].rel_url, combine_tests[i].flags, buf, + hres = IInternetProtocolInfo_CombineUrl(info, a2w(combine_tests[i].base_url), + a2w(combine_tests[i].rel_url), combine_tests[i].flags, buf, sizeof(buf)/sizeof(WCHAR), &size, 0); ok(hres == combine_tests[i].hres, "[%d] CombineUrl returned %08x, expected %08x\n", i, hres, combine_tests[i].hres); - ok(size == (combine_tests[i].combined_url ? lstrlenW(combine_tests[i].combined_url)+1 + ok(size == (combine_tests[i].combined_url ? strlen(combine_tests[i].combined_url)+1 : 0xdeadbeef), "[%d] unexpected size=%d\n", i, size); if(combine_tests[i].combined_url) - ok(!lstrcmpW(combine_tests[i].combined_url, buf), "[%d] unexpected result\n", i); + ok(!strcmp_wa(buf, combine_tests[i].combined_url), "[%d] unexpected result: %s\n", i, wine_dbgstr_w(buf)); else ok(buf[0] == 0xfefe, "buf changed\n"); } size = 0xdeadbeef; memset(buf, 0xfe, sizeof(buf)); - hres = IInternetProtocolInfo_CombineUrl(info, blank_url1, rel_url1, 0, buf, + hres = IInternetProtocolInfo_CombineUrl(info, a2w("its:test.chm::/blank.html"), a2w("test.html"), 0, buf, 1, &size, 0); ok(hres == E_OUTOFMEMORY, "CombineUrl failed: %08x\n", hres); - ok(size == sizeof(combined_url1)/sizeof(WCHAR), "size=%d\n", size); + ok(size == 25, "size=%d\n", size); ok(buf[0] == 0xfefe, "buf changed\n"); IInternetProtocolInfo_Release(info);
1
0
0
0
Huw Davies : riched20: Flush the output buffer before a codepage change.
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: 368f9123c9e465e2f212e35ee5c920847c73b5af URL:
http://source.winehq.org/git/wine.git/?a=commit;h=368f9123c9e465e2f212e35ee…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Dec 5 14:17:53 2012 +0000 riched20: Flush the output buffer before a codepage change. --- dlls/riched20/reader.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c index 9f88cf7..02d4636 100644 --- a/dlls/riched20/reader.c +++ b/dlls/riched20/reader.c @@ -2397,8 +2397,11 @@ CharAttr(RTF_Info *info) font = RTFGetFont(info, info->rtfParam); if (font) { - if (info->ansiCodePage != CP_UTF8) + if (info->ansiCodePage != CP_UTF8 && info->codePage != font->rtfFCodePage) + { + RTFFlushOutputBuffer(info); info->codePage = font->rtfFCodePage; + } TRACE("font %d codepage %d\n", info->rtfParam, info->codePage); } else
1
0
0
0
Jacek Caban : jscript: Treat VT_UNKNOWN VARIANTs supporting IDispatch interface as VT_DISPATCH.
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: 11f41aa05a993bc1c6b6d6b7a672632cb906b649 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=11f41aa05a993bc1c6b6d6b7a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Dec 5 14:49:42 2012 +0100 jscript: Treat VT_UNKNOWN VARIANTs supporting IDispatch interface as VT_DISPATCH. --- dlls/jscript/jsutils.c | 12 ++++++++++++ dlls/jscript/tests/run.c | 23 ++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index ac26ef3..91e0397 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -315,6 +315,18 @@ HRESULT variant_to_jsval(VARIANT *var, jsval_t *r) case VT_INT: *r = jsval_number(V_INT(var)); return S_OK; + case VT_UNKNOWN: + if(V_UNKNOWN(var)) { + IDispatch *disp; + HRESULT hres; + + hres = IUnknown_QueryInterface(V_UNKNOWN(var), &IID_IDispatch, (void**)&disp); + if(SUCCEEDED(hres)) { + *r = jsval_disp(disp); + return S_OK; + } + } + /* fall through */ default: return jsval_variant(r, var); } diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index cacad25..3c5422c 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -125,6 +125,7 @@ DEFINE_EXPECT(DeleteMemberByDispID); #define DISPID_GLOBAL_GETSHORT 0x1014 #define DISPID_GLOBAL_TESTARGTYPES 0x1015 #define DISPID_GLOBAL_INTPROP 0x1016 +#define DISPID_GLOBAL_DISPUNK 0x1017 #define DISPID_GLOBAL_TESTPROPDELETE 0x2000 @@ -592,6 +593,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD return S_OK; } + if(!strcmp_wa(bstrName, "dispUnk")) { + *pid = DISPID_GLOBAL_DISPUNK; + return S_OK; + } + if(strict_dispid_check && strcmp_wa(bstrName, "t")) ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName)); return DISP_E_UNKNOWNNAME; @@ -987,8 +993,13 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, V_INT(pvarRes) = 22; return S_OK; + case DISPID_GLOBAL_DISPUNK: + V_VT(pvarRes) = VT_UNKNOWN; + V_UNKNOWN(pvarRes) = (IUnknown*)&testObj; + return S_OK; + case DISPID_GLOBAL_TESTARGTYPES: { - VARIANT args[2]; + VARIANT args[3]; DISPPARAMS dp = {args, NULL, sizeof(args)/sizeof(*args), 0}; HRESULT hres; @@ -996,7 +1007,7 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags); ok(pdp != NULL, "pdp == NULL\n"); ok(pdp->rgvarg != NULL, "rgvarg != NULL\n"); - ok(pdp->cArgs == 5, "cArgs = %d\n", pdp->cArgs); + ok(pdp->cArgs == 6, "cArgs = %d\n", pdp->cArgs); ok(!pvarRes, "pvarRes != NULL\n"); ok(V_VT(pdp->rgvarg+1) == VT_I4, "V_VT(pdp->rgvarg+1) = %d\n", V_VT(pdp->rgvarg+1)); @@ -1011,12 +1022,17 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, ok(V_VT(pdp->rgvarg+4) == VT_I4, "V_VT(pdp->rgvarg+4) = %d\n", V_VT(pdp->rgvarg+4)); ok(V_I4(pdp->rgvarg+4) == 22, "V_I4(pdp->rgvarg+4) = %d\n", V_I4(pdp->rgvarg+4)); + ok(V_VT(pdp->rgvarg+5) == VT_DISPATCH, "V_VT(pdp->rgvarg+5) = %d\n", V_VT(pdp->rgvarg+5)); + ok(V_DISPATCH(pdp->rgvarg+5) == (IDispatch*)&testObj, "V_DISPATCH(pdp->rgvarg+5) != testObj\n"); + ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg)); V_VT(args) = VT_I2; V_I2(args) = 2; V_VT(args+1) = VT_INT; V_INT(args+1) = 22; + V_VT(args+2) = VT_UNKNOWN; + V_UNKNOWN(args+2) = (IUnknown*)&testObj; hres = IDispatch_Invoke(V_DISPATCH(pdp->rgvarg), DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL); ok(hres == S_OK, "Invoke failed: %08x\n", hres); @@ -1839,9 +1855,10 @@ static BOOL run_tests(void) CHECK_CALLED(global_propargput_i); SET_EXPECT(global_testargtypes_i); - parse_script_a("testArgTypes(intProp(), intProp, getShort(), shortProp, function(i,s) {" + parse_script_a("testArgTypes(dispUnk, intProp(), intProp, getShort(), shortProp, function(d,i,s) {" " ok(getVT(i) === 'VT_I4', 'getVT(i) = ' + getVT(i));" " ok(getVT(s) === 'VT_I4', 'getVT(s) = ' + getVT(s));" + " ok(getVT(d) === 'VT_DISPATCH', 'getVT(d) = ' + getVT(d));" "});"); CHECK_CALLED(global_testargtypes_i);
1
0
0
0
Alexandre Julliard : gdi32: Remove special handling for linked fonts in ExtTextOut.
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: 6144824965ec6e6a323979f18df7b15feaf3f0a4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6144824965ec6e6a323979f18…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Dec 5 16:44:15 2012 +0100 gdi32: Remove special handling for linked fonts in ExtTextOut. --- dlls/gdi32/font.c | 75 +-------------------------------------------- dlls/gdi32/freetype.c | 26 ---------------- dlls/gdi32/gdi_private.h | 1 - 3 files changed, 2 insertions(+), 100 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 8580fcb..f84e707 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -2371,79 +2371,8 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, } } - if(FontIsLinked(hdc) && !(flags & ETO_GLYPH_INDEX)) - { - HFONT orig_font = dc->hFont, cur_font; - UINT glyph; - INT span = 0; - POINT *offsets = NULL; - unsigned int i; - - glyphs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WORD)); - for(i = 0; i < count; i++) - { - WineEngGetLinkedHFont(dc, reordered_str[i], &cur_font, &glyph); - if(cur_font != dc->hFont) - { - if(!offsets) - { - unsigned int j; - offsets = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*deltas)); - offsets[0].x = offsets[0].y = 0; - - if(!deltas) - { - SIZE tmpsz; - for(j = 1; j < count; j++) - { - GetTextExtentPointW(hdc, reordered_str + j - 1, 1, &tmpsz); - offsets[j].x = offsets[j - 1].x + abs(INTERNAL_XWSTODS(dc, tmpsz.cx)); - offsets[j].y = 0; - } - } - else - { - for(j = 1; j < count; j++) - { - offsets[j].x = offsets[j - 1].x + deltas[j].x; - offsets[j].y = offsets[j - 1].y + deltas[j].y; - } - } - } - if(span) - { - physdev->funcs->pExtTextOut( physdev, x + offsets[i - span].x, - y + offsets[i - span].y, - (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, glyphs, - span, deltas ? (INT*)(deltas + (i - span)) : NULL); - span = 0; - } - SelectObject(hdc, cur_font); - } - glyphs[span++] = glyph; - - if(i == count - 1) - { - ret = physdev->funcs->pExtTextOut(physdev, x + (offsets ? offsets[count - span].x : 0), - y + (offsets ? offsets[count - span].y : 0), - (flags & ~ETO_OPAQUE) | ETO_GLYPH_INDEX, &rc, glyphs, - span, deltas ? (INT*)(deltas + (count - span)) : NULL); - SelectObject(hdc, orig_font); - HeapFree(GetProcessHeap(), 0, offsets); - } - } - } - else - { - if(!(flags & ETO_GLYPH_INDEX) && dc->gdiFont) - { - glyphs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WORD)); - GetGlyphIndicesW(hdc, reordered_str, count, glyphs, 0); - flags |= ETO_GLYPH_INDEX; - } - ret = physdev->funcs->pExtTextOut( physdev, x, y, (flags & ~ETO_OPAQUE), &rc, - glyphs ? glyphs : reordered_str, count, (INT*)deltas ); - } + ret = physdev->funcs->pExtTextOut( physdev, x, y, (flags & ~ETO_OPAQUE), &rc, + glyphs ? glyphs : reordered_str, count, (INT*)deltas ); done: HeapFree(GetProcessHeap(), 0, deltas); diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index c5543e1..f9db1d7 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -7431,27 +7431,6 @@ static UINT freetype_GetTextCharsetInfo( PHYSDEV dev, LPFONTSIGNATURE fs, DWORD return physdev->font->charset; } -BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) -{ - GdiFont *font = dc->gdiFont, *linked_font; - struct list *first_hfont; - BOOL ret; - - GDI_CheckNotLock(); - EnterCriticalSection( &freetype_cs ); - ret = get_glyph_index_linked(font, c, &linked_font, glyph); - TRACE("get_glyph_index_linked glyph %d font %p\n", *glyph, linked_font); - if(font == linked_font) - *new_hfont = dc->hFont; - else - { - first_hfont = list_head(&linked_font->hfontlist); - *new_hfont = LIST_ENTRY(first_hfont, struct tagHFONTLIST, entry)->hfont; - } - LeaveCriticalSection( &freetype_cs ); - return ret; -} - /* Retrieve a list of supported Unicode ranges for a given font. * Can be called with NULL gs to calculate the buffer size. Returns * the number of ranges found. @@ -8020,11 +7999,6 @@ BOOL WineEngCreateScalableFontResource( DWORD hidden, LPCWSTR resource, return FALSE; } -BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) -{ - return FALSE; -} - /************************************************************************* * GetRasterizerCaps (GDI32.@) */ diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index e3fe577..2408c97 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -294,7 +294,6 @@ extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN; extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN; extern BOOL WineEngCreateScalableFontResource(DWORD, LPCWSTR, LPCWSTR, LPCWSTR) DECLSPEC_HIDDEN; extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN; -extern BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) DECLSPEC_HIDDEN; extern BOOL WineEngInit(void) DECLSPEC_HIDDEN; extern BOOL WineEngRemoveFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
1
0
0
0
Alexandre Julliard : wineps: Support getting character codes instead of glyphs in ExtTextOut.
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: 55353027581472ea0ce1add7940e5fa43373236d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=55353027581472ea0ce1add79…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Dec 5 17:23:49 2012 +0100 wineps: Support getting character codes instead of glyphs in ExtTextOut. --- dlls/wineps.drv/download.c | 2 +- dlls/wineps.drv/psdrv.h | 2 +- dlls/wineps.drv/text.c | 15 ++++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/dlls/wineps.drv/download.c b/dlls/wineps.drv/download.c index f984225..5163cef 100644 --- a/dlls/wineps.drv/download.c +++ b/dlls/wineps.drv/download.c @@ -366,7 +366,7 @@ void get_glyph_name(HDC hdc, WORD index, char *name) * Download and write out a number of glyphs * */ -BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, WORD *glyphs, +BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, const WORD *glyphs, UINT count) { PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h index 1e76bef..bfc2ad6 100644 --- a/dlls/wineps.drv/psdrv.h +++ b/dlls/wineps.drv/psdrv.h @@ -539,7 +539,7 @@ extern BOOL PSDRV_WriteBuiltinGlyphShow(PHYSDEV dev, LPCWSTR str, INT count) DEC extern BOOL PSDRV_SelectDownloadFont(PHYSDEV dev) DECLSPEC_HIDDEN; extern BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev) DECLSPEC_HIDDEN; -extern BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, WORD *glpyhs, UINT count) DECLSPEC_HIDDEN; +extern BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, const WORD *glpyhs, UINT count) DECLSPEC_HIDDEN; extern BOOL PSDRV_EmptyDownloadList(PHYSDEV dev, BOOL write_undef) DECLSPEC_HIDDEN; extern DWORD write_spool( PHYSDEV dev, const void *data, DWORD num ) DECLSPEC_HIDDEN; diff --git a/dlls/wineps.drv/text.c b/dlls/wineps.drv/text.c index a35945a..6b5fe45 100644 --- a/dlls/wineps.drv/text.c +++ b/dlls/wineps.drv/text.c @@ -100,14 +100,18 @@ static BOOL PSDRV_Text(PHYSDEV dev, INT x, INT y, UINT flags, LPCWSTR str, if (!count) return TRUE; - if(physDev->font.fontloc == Download) - glyphs = (LPWORD)str; + if(physDev->font.fontloc == Download && !(flags & ETO_GLYPH_INDEX)) + { + glyphs = HeapAlloc( GetProcessHeap(), 0, count * sizeof(WORD) ); + GetGlyphIndicesW( dev->hdc, str, count, glyphs, 0 ); + str = glyphs; + } PSDRV_WriteMoveTo(dev, x, y); if(!lpDx) { if(physDev->font.fontloc == Download) - PSDRV_WriteDownloadGlyphShow(dev, glyphs, count); + PSDRV_WriteDownloadGlyphShow(dev, str, count); else PSDRV_WriteBuiltinGlyphShow(dev, str, count); } @@ -117,7 +121,7 @@ static BOOL PSDRV_Text(PHYSDEV dev, INT x, INT y, UINT flags, LPCWSTR str, for(i = 0; i < count-1; i++) { if(physDev->font.fontloc == Download) - PSDRV_WriteDownloadGlyphShow(dev, glyphs + i, 1); + PSDRV_WriteDownloadGlyphShow(dev, str + i, 1); else PSDRV_WriteBuiltinGlyphShow(dev, str + i, 1); if(flags & ETO_PDY) @@ -130,10 +134,11 @@ static BOOL PSDRV_Text(PHYSDEV dev, INT x, INT y, UINT flags, LPCWSTR str, PSDRV_WriteMoveTo(dev, x + offset.x, y + offset.y); } if(physDev->font.fontloc == Download) - PSDRV_WriteDownloadGlyphShow(dev, glyphs + i, 1); + PSDRV_WriteDownloadGlyphShow(dev, str + i, 1); else PSDRV_WriteBuiltinGlyphShow(dev, str + i, 1); } + HeapFree( GetProcessHeap(), 0, glyphs ); return TRUE; }
1
0
0
0
Alexandre Julliard : gdi32: Support getting character codes instead of glyphs in ExtTextOut for the path driver .
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: 491123e17bfb80ccac2a37771ebb257652efc076 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=491123e17bfb80ccac2a37771…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Dec 5 17:32:35 2012 +0100 gdi32: Support getting character codes instead of glyphs in ExtTextOut for the path driver. --- dlls/gdi32/path.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 38210ca..2c54e94 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -1511,10 +1511,11 @@ static BOOL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const REC LPCWSTR str, UINT count, const INT *dx ) { struct path_physdev *physdev = get_path_physdev( dev ); - unsigned int idx; + unsigned int idx, ggo_flags = GGO_NATIVE; POINT offset = {0, 0}; if (!count) return TRUE; + if (flags & ETO_GLYPH_INDEX) ggo_flags |= GGO_GLYPH_INDEX; for (idx = 0; idx < count; idx++) { @@ -1523,8 +1524,7 @@ static BOOL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const REC DWORD dwSize; void *outline; - dwSize = GetGlyphOutlineW(dev->hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, - &gm, 0, NULL, &identity); + dwSize = GetGlyphOutlineW(dev->hdc, str[idx], ggo_flags, &gm, 0, NULL, &identity); if (dwSize == GDI_ERROR) return FALSE; /* add outline only if char is printable */ @@ -1533,9 +1533,7 @@ static BOOL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const REC outline = HeapAlloc(GetProcessHeap(), 0, dwSize); if (!outline) return FALSE; - GetGlyphOutlineW(dev->hdc, str[idx], GGO_GLYPH_INDEX | GGO_NATIVE, - &gm, dwSize, outline, &identity); - + GetGlyphOutlineW(dev->hdc, str[idx], ggo_flags, &gm, dwSize, outline, &identity); PATH_add_outline(physdev, x + offset.x, y + offset.y, outline, dwSize); HeapFree(GetProcessHeap(), 0, outline);
1
0
0
0
Alexandre Julliard : gdi32: Support caching glyphs by character code and not only by glyph index.
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: 78626cdbaa0419e78d5bf5537e084b0e8cef9234 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=78626cdbaa0419e78d5bf5537…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Dec 5 16:41:08 2012 +0100 gdi32: Support caching glyphs by character code and not only by glyph index. --- dlls/gdi32/dibdrv/graphics.c | 61 ++++++++++++++++++++++++++--------------- dlls/gdi32/font.c | 12 ++++---- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c index 0b843fe..d0b7a39 100644 --- a/dlls/gdi32/dibdrv/graphics.c +++ b/dlls/gdi32/dibdrv/graphics.c @@ -33,6 +33,13 @@ struct cached_glyph BYTE bits[1]; }; +enum glyph_type +{ + GLYPH_INDEX, + GLYPH_WCHAR, + GLYPH_NBTYPES +}; + struct cached_font { struct list entry; @@ -41,8 +48,8 @@ struct cached_font LOGFONTW lf; XFORM xform; UINT aa_flags; - UINT nb_glyphs; - struct cached_glyph **glyphs; + UINT nb_glyphs[GLYPH_NBTYPES]; + struct cached_glyph **glyphs[GLYPH_NBTYPES]; }; static struct list font_cache = LIST_INIT( font_cache ); @@ -487,7 +494,7 @@ static int font_cache_cmp( const struct cached_font *p1, const struct cached_fon static struct cached_font *add_cached_font( HDC hdc, HFONT hfont, UINT aa_flags ) { struct cached_font font, *ptr, *last_unused = NULL; - UINT i = 0; + UINT i = 0, j; GetObjectW( hfont, sizeof(font.lf), &font.lf ); GetTransform( hdc, 0x204, &font.xform ); @@ -517,8 +524,11 @@ static struct cached_font *add_cached_font( HDC hdc, HFONT hfont, UINT aa_flags if (i > 5) /* keep at least 5 of the most-recently used fonts around */ { ptr = last_unused; - for (i = 0; i < ptr->nb_glyphs; i++) HeapFree( GetProcessHeap(), 0, ptr->glyphs[i] ); - HeapFree( GetProcessHeap(), 0, ptr->glyphs ); + for (i = 0; i < GLYPH_NBTYPES; i++) + { + for (j = 0; j < ptr->nb_glyphs[i]; j++) HeapFree( GetProcessHeap(), 0, ptr->glyphs[i][j] ); + HeapFree( GetProcessHeap(), 0, ptr->glyphs[i] ); + } list_remove( &ptr->entry ); } else if (!(ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(*ptr) ))) @@ -529,9 +539,11 @@ static struct cached_font *add_cached_font( HDC hdc, HFONT hfont, UINT aa_flags *ptr = font; ptr->ref = 1; - ptr->glyphs = NULL; - ptr->nb_glyphs = 0; - + for (i = 0; i < GLYPH_NBTYPES; i++) + { + ptr->glyphs[i] = NULL; + ptr->nb_glyphs[i] = 0; + } done: list_add_head( &font_cache, &ptr->entry ); LeaveCriticalSection( &font_cache_cs ); @@ -544,28 +556,32 @@ void release_cached_font( struct cached_font *font ) if (font) InterlockedDecrement( &font->ref ); } -static void add_cached_glyph( struct cached_font *font, UINT index, struct cached_glyph *glyph ) +static void add_cached_glyph( struct cached_font *font, UINT index, UINT flags, struct cached_glyph *glyph ) { - if (index >= font->nb_glyphs) + enum glyph_type type = (flags & ETO_GLYPH_INDEX) ? GLYPH_INDEX : GLYPH_WCHAR; + + if (index >= font->nb_glyphs[type]) { UINT new_count = (index + 128) & ~127; struct cached_glyph **new; - if (font->glyphs) + if (font->glyphs[type]) new = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - font->glyphs, new_count * sizeof(*new) ); + font->glyphs[type], new_count * sizeof(*new) ); else new = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * sizeof(*new) ); if (!new) return; - font->glyphs = new; - font->nb_glyphs = new_count; + font->glyphs[type] = new; + font->nb_glyphs[type] = new_count; } - font->glyphs[index] = glyph; + font->glyphs[type][index] = glyph; } -static struct cached_glyph *get_cached_glyph( struct cached_font *font, UINT index ) +static struct cached_glyph *get_cached_glyph( struct cached_font *font, UINT index, UINT flags ) { - if (index < font->nb_glyphs) return font->glyphs[index]; + enum glyph_type type = (flags & ETO_GLYPH_INDEX) ? GLYPH_INDEX : GLYPH_WCHAR; + + if (index < font->nb_glyphs[type]) return font->glyphs[type][index]; return NULL; } @@ -654,9 +670,9 @@ static const int padding[4] = {0, 3, 2, 1}; * For non-antialiased bitmaps convert them to the 17-level format * using only values 0 or 16. */ -static struct cached_glyph *cache_glyph_bitmap( HDC hdc, struct cached_font *font, UINT index ) +static struct cached_glyph *cache_glyph_bitmap( HDC hdc, struct cached_font *font, UINT index, UINT flags ) { - UINT ggo_flags = font->aa_flags | GGO_GLYPH_INDEX; + UINT ggo_flags = font->aa_flags; static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} }; UINT indices[3] = {0, 0, 0x20}; int i, x, y; @@ -666,6 +682,7 @@ static struct cached_glyph *cache_glyph_bitmap( HDC hdc, struct cached_font *fon GLYPHMETRICS metrics; struct cached_glyph *glyph; + if (flags & ETO_GLYPH_INDEX) ggo_flags |= GGO_GLYPH_INDEX; indices[0] = index; for (i = 0; i < sizeof(indices) / sizeof(indices[0]); i++) { @@ -712,7 +729,7 @@ static struct cached_glyph *cache_glyph_bitmap( HDC hdc, struct cached_font *fon done: glyph->metrics = metrics; - add_cached_glyph( font, index, glyph ); + add_cached_glyph( font, index, flags, glyph ); return glyph; } @@ -740,8 +757,8 @@ static void render_string( HDC hdc, dib_info *dib, struct cached_font *font, INT EnterCriticalSection( &font_cache_cs ); for (i = 0; i < count; i++) { - if (!(glyph = get_cached_glyph( font, str[i] )) && - !(glyph = cache_glyph_bitmap( hdc, font, str[i] ))) continue; + if (!(glyph = get_cached_glyph( font, str[i], flags )) && + !(glyph = cache_glyph_bitmap( hdc, font, str[i], flags ))) continue; glyph_dib.width = glyph->metrics.gmBlackBoxX; glyph_dib.height = glyph->metrics.gmBlackBoxY; diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 027c392..8580fcb 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -1710,10 +1710,9 @@ BOOL WINAPI GetCharWidth32A( HDC hdc, UINT firstChar, UINT lastChar, /* helper for nulldrv_ExtTextOut */ -static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, +static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT flags, UINT aa_flags, GLYPHMETRICS *metrics, struct gdi_image_bits *image ) { - UINT ggo_flags = aa_flags | GGO_GLYPH_INDEX; static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} }; UINT indices[3] = {0, 0, 0x20}; int i; @@ -1721,11 +1720,12 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, int stride; indices[0] = index; + if (flags & ETO_GLYPH_INDEX) aa_flags |= GGO_GLYPH_INDEX; for (i = 0; i < sizeof(indices) / sizeof(indices[0]); i++) { index = indices[i]; - ret = GetGlyphOutlineW( hdc, index, ggo_flags, metrics, 0, NULL, &identity ); + ret = GetGlyphOutlineW( hdc, index, aa_flags, metrics, 0, NULL, &identity ); if (ret != GDI_ERROR) break; } @@ -1743,7 +1743,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, image->is_copy = TRUE; image->free = free_heap_bits; - ret = GetGlyphOutlineW( hdc, index, ggo_flags, metrics, size, image->ptr, &identity ); + ret = GetGlyphOutlineW( hdc, index, aa_flags, metrics, size, image->ptr, &identity ); if (ret == GDI_ERROR) { HeapFree( GetProcessHeap(), 0, image->ptr ); @@ -1764,7 +1764,7 @@ static RECT get_total_extents( HDC hdc, INT x, INT y, UINT flags, UINT aa_flags, { GLYPHMETRICS metrics; - if (get_glyph_bitmap( hdc, (UINT)str[i], aa_flags, &metrics, NULL )) continue; + if (get_glyph_bitmap( hdc, str[i], flags, aa_flags, &metrics, NULL )) continue; rect.left = x + metrics.gmptGlyphOrigin.x; rect.top = y - metrics.gmptGlyphOrigin.y; @@ -1949,7 +1949,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect GLYPHMETRICS metrics; struct gdi_image_bits image; - err = get_glyph_bitmap( dev->hdc, (UINT)str[i], GGO_BITMAP, &metrics, &image ); + err = get_glyph_bitmap( dev->hdc, str[i], flags, GGO_BITMAP, &metrics, &image ); if (err) continue; if (image.ptr) draw_glyph( dev->hdc, x, y, &metrics, &image, (flags & ETO_CLIPPED) ? rect : NULL );
1
0
0
0
Alexandre Julliard : winex11: Support caching glyphs by character code and not only by glyph index.
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: b4ef8a0ee127b043a9954ecf388ba89ff0aa5b93 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b4ef8a0ee127b043a9954ecf3…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Dec 5 16:41:19 2012 +0100 winex11: Support caching glyphs by character code and not only by glyph index. --- dlls/winex11.drv/xrender.c | 72 ++++++++++++++++++++++--------------------- 1 files changed, 37 insertions(+), 35 deletions(-) diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index d1d1ccc..4da2eb4 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -132,6 +132,8 @@ typedef struct #define INITIAL_REALIZED_BUF_SIZE 128 +enum glyph_type { GLYPH_INDEX, GLYPH_WCHAR, GLYPH_NBTYPES }; + typedef enum { AA_None = 0, AA_Grey, AA_RGB, AA_BGR, AA_VRGB, AA_VBGR, AA_MAXVALUE } AA_Type; typedef struct @@ -146,7 +148,7 @@ typedef struct typedef struct { LFANDSIZE lfsz; - gsCacheEntryFormat * format[AA_MAXVALUE]; + gsCacheEntryFormat *format[GLYPH_NBTYPES][AA_MAXVALUE]; INT count; INT next; } gsCacheEntry; @@ -639,30 +641,33 @@ static int LookupEntry(LFANDSIZE *plfsz) static void FreeEntry(int entry) { - int format; + int type, format; - for(format = 0; format < AA_MAXVALUE; format++) { - gsCacheEntryFormat * formatEntry; + for (type = 0; type < GLYPH_NBTYPES; type++) + { + for(format = 0; format < AA_MAXVALUE; format++) { + gsCacheEntryFormat * formatEntry; - if( !glyphsetCache[entry].format[format] ) - continue; + if( !glyphsetCache[entry].format[type][format] ) + continue; - formatEntry = glyphsetCache[entry].format[format]; + formatEntry = glyphsetCache[entry].format[type][format]; - if(formatEntry->glyphset) { - pXRenderFreeGlyphSet(gdi_display, formatEntry->glyphset); - formatEntry->glyphset = 0; - } - if(formatEntry->nrealized) { - HeapFree(GetProcessHeap(), 0, formatEntry->realized); - formatEntry->realized = NULL; - HeapFree(GetProcessHeap(), 0, formatEntry->gis); - formatEntry->gis = NULL; - formatEntry->nrealized = 0; - } + if(formatEntry->glyphset) { + pXRenderFreeGlyphSet(gdi_display, formatEntry->glyphset); + formatEntry->glyphset = 0; + } + if(formatEntry->nrealized) { + HeapFree(GetProcessHeap(), 0, formatEntry->realized); + formatEntry->realized = NULL; + HeapFree(GetProcessHeap(), 0, formatEntry->gis); + formatEntry->gis = NULL; + formatEntry->nrealized = 0; + } - HeapFree(GetProcessHeap(), 0, formatEntry); - glyphsetCache[entry].format[format] = NULL; + HeapFree(GetProcessHeap(), 0, formatEntry); + glyphsetCache[entry].format[type][format] = NULL; + } } } @@ -736,7 +741,6 @@ static int AllocEntry(void) static int GetCacheEntry( LFANDSIZE *plfsz ) { int ret; - int format; gsCacheEntry *entry; if((ret = LookupEntry(plfsz)) != -1) return ret; @@ -744,10 +748,6 @@ static int GetCacheEntry( LFANDSIZE *plfsz ) ret = AllocEntry(); entry = glyphsetCache + ret; entry->lfsz = *plfsz; - for( format = 0; format < AA_MAXVALUE; format++ ) { - assert( !entry->format[format] ); - } - return ret; } @@ -1026,7 +1026,7 @@ static void xrenderdrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn ) * * Helper to ExtTextOut. Must be called inside xrender_cs */ -static void UploadGlyph(struct xrender_physdev *physDev, int glyph) +static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_type type) { unsigned int buflen; char *buf; @@ -1035,18 +1035,19 @@ static void UploadGlyph(struct xrender_physdev *physDev, int glyph) XGlyphInfo gi; gsCacheEntry *entry = glyphsetCache + physDev->cache_index; gsCacheEntryFormat *formatEntry; - UINT ggo_format = GGO_GLYPH_INDEX | physDev->aa_flags; + UINT ggo_format = physDev->aa_flags; AA_Type format = aa_type_from_flags( physDev->aa_flags ); enum wxr_format wxr_format; static const char zero[4]; static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; + if (type == GLYPH_INDEX) ggo_format |= GGO_GLYPH_INDEX; buflen = GetGlyphOutlineW(physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL, &identity); if(buflen == GDI_ERROR) { if(format != AA_None) { format = AA_None; physDev->aa_flags = GGO_BITMAP; - ggo_format = GGO_GLYPH_INDEX | GGO_BITMAP; + ggo_format = (ggo_format & GGO_GLYPH_INDEX) | GGO_BITMAP; buflen = GetGlyphOutlineW(physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL, &identity); } if(buflen == GDI_ERROR) { @@ -1065,12 +1066,12 @@ static void UploadGlyph(struct xrender_physdev *physDev, int glyph) } /* If there is nothing for the current type, we create the entry. */ - if( !entry->format[format] ) { - entry->format[format] = HeapAlloc(GetProcessHeap(), + if( !entry->format[type][format] ) { + entry->format[type][format] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(gsCacheEntryFormat)); } - formatEntry = entry->format[format]; + formatEntry = entry->format[type][format]; if(formatEntry->nrealized <= glyph) { formatEntry->nrealized = (glyph / 128 + 1) * 128; @@ -1315,6 +1316,7 @@ static BOOL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, int render_op = PictOpOver; XRenderColor col; RECT rect, bounds; + enum glyph_type type = (flags & ETO_GLYPH_INDEX) ? GLYPH_INDEX : GLYPH_WCHAR; get_xrender_color( physdev, GetTextColor( physdev->dev.hdc ), &col ); pict = get_xrender_picture( physdev, 0, (flags & ETO_CLIPPED) ? lprect : NULL ); @@ -1343,15 +1345,15 @@ static BOOL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, EnterCriticalSection(&xrender_cs); entry = glyphsetCache + physdev->cache_index; - formatEntry = entry->format[aa_type_from_flags( physdev->aa_flags )]; + formatEntry = entry->format[type][aa_type_from_flags( physdev->aa_flags )]; for(idx = 0; idx < count; idx++) { if( !formatEntry ) { - UploadGlyph(physdev, wstr[idx]); + UploadGlyph(physdev, wstr[idx], type); /* re-evaluate format entry since aa_flags may have changed */ - formatEntry = entry->format[aa_type_from_flags( physdev->aa_flags )]; + formatEntry = entry->format[type][aa_type_from_flags( physdev->aa_flags )]; } else if( wstr[idx] >= formatEntry->nrealized || formatEntry->realized[wstr[idx]] == FALSE) { - UploadGlyph(physdev, wstr[idx]); + UploadGlyph(physdev, wstr[idx], type); } } if (!formatEntry)
1
0
0
0
Detlef Riekenberg : shell32/tests: Add tests for DoEnvironmentSubstA/W.
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: fc3868a07f18063ee2397aea7fbbd4af9e0e04c8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fc3868a07f18063ee2397aea7…
Author: Detlef Riekenberg <wine.dev(a)web.de> Date: Tue Dec 4 11:38:02 2012 +0100 shell32/tests: Add tests for DoEnvironmentSubstA/W. --- dlls/shell32/tests/shellpath.c | 152 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 152 insertions(+), 0 deletions(-) diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 1798ada..729a341 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -2495,6 +2495,157 @@ static void test_knownFolders(void) CoUninitialize(); } + +static void test_DoEnvironmentSubst(void) +{ + WCHAR expectedW[MAX_PATH]; + WCHAR bufferW[MAX_PATH]; + CHAR expectedA[MAX_PATH]; + CHAR bufferA[MAX_PATH]; + DWORD res; + DWORD res2; + DWORD len; + INT i; + static const WCHAR does_not_existW[] = {'%','D','O','E','S','_','N','O','T','_','E','X','I','S','T','%',0}; + static const CHAR does_not_existA[] = "%DOES_NOT_EXIST%"; + static const CHAR *names[] = { + /* interactive apps and services (works on all windows versions) */ + "%ALLUSERSPROFILE%", "%APPDATA%", "%LOCALAPPDATA%", + "%NUMBER_OF_PROCESSORS%", "%OS%", "%PROCESSOR_ARCHITECTURE%", + "%PROCESSOR_IDENTIFIER%", "%PROCESSOR_LEVEL%", "%PROCESSOR_REVISION%", + "%ProgramFiles%", "%SystemDrive%", + "%SystemRoot%", "%USERPROFILE%", "%windir%", + /* todo_wine: "%COMPUTERNAME%", "%ProgramData%", "%PUBLIC%", */ + + /* replace more than one var is allowed */ + "%HOMEDRIVE%%HOMEPATH%", + "%OS% %windir%"}; /* always the last entry in the table */ + + for (i = 0; i < (sizeof(names)/sizeof(LPSTR)); i++) + { + memset(bufferA, '#', MAX_PATH - 1); + bufferA[MAX_PATH - 1] = 0; + lstrcpyA(bufferA, names[i]); + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); + + res2 = ExpandEnvironmentStringsA(names[i], expectedA, MAX_PATH); + res = DoEnvironmentSubstA(bufferA, MAX_PATH); + + /* is the space for the terminating 0 included? */ + if (!i && HIWORD(res) && (LOWORD(res) == (lstrlenA(bufferA)))) + { + win_skip("DoEnvironmentSubstA/W are broken on NT 4\n"); + return; + } + ok(HIWORD(res) && (LOWORD(res) == res2), + "%d: got %d/%d (expected TRUE/%d)\n", i, HIWORD(res), LOWORD(res), res2); + ok(!lstrcmpA(bufferA, expectedA), + "%d: got %s (expected %s)\n", i, bufferA, expectedA); + + res2 = ExpandEnvironmentStringsW(bufferW, expectedW, MAX_PATH); + res = DoEnvironmentSubstW(bufferW, MAX_PATH); + ok(HIWORD(res) && (LOWORD(res) == res2), + "%d: got %d/%d (expected TRUE/%d)\n", i, HIWORD(res), LOWORD(res), res2); + ok(!lstrcmpW(bufferW, expectedW), + "%d: got %s (expected %s)\n", i, wine_dbgstr_w(bufferW), wine_dbgstr_w(expectedW)); + } + + i--; /* reuse data in the last table entry */ + len = LOWORD(res); /* needed length */ + + /* one character extra is fine */ + memset(bufferA, '#', MAX_PATH - 1); + bufferA[len + 2] = 0; + lstrcpyA(bufferA, names[i]); + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); + + res2 = ExpandEnvironmentStringsA(bufferA, expectedA, MAX_PATH); + res = DoEnvironmentSubstA(bufferA, len + 1); + ok(HIWORD(res) && (LOWORD(res) == res2), + "+1: got %d/%d (expected TRUE/%d)\n", HIWORD(res), LOWORD(res), res2); + ok(!lstrcmpA(bufferA, expectedA), + "+1: got %s (expected %s)\n", bufferA, expectedA); + + res2 = ExpandEnvironmentStringsW(bufferW, expectedW, MAX_PATH); + res = DoEnvironmentSubstW(bufferW, len + 1); + ok(HIWORD(res) && (LOWORD(res) == res2), + "+1: got %d/%d (expected TRUE/%d)\n", HIWORD(res), LOWORD(res), res2); + ok(!lstrcmpW(bufferW, expectedW), + "+1: got %s (expected %s)\n", wine_dbgstr_w(bufferW), wine_dbgstr_w(expectedW)); + + + /* minimal buffer length (result string and terminating 0) */ + memset(bufferA, '#', MAX_PATH - 1); + bufferA[len + 2] = 0; + lstrcpyA(bufferA, names[i]); + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); + + /* ANSI version failed without an extra byte, as documented on msdn */ + res = DoEnvironmentSubstA(bufferA, len); + ok(!HIWORD(res) && (LOWORD(res) == len), + " 0: got %d/%d (expected FALSE/%d)\n", HIWORD(res), LOWORD(res), len); + ok(!lstrcmpA(bufferA, names[i]), + " 0: got %s (expected %s)\n", bufferA, names[i]); + + /* DoEnvironmentSubstW works as expected */ + res2 = ExpandEnvironmentStringsW(bufferW, expectedW, MAX_PATH); + res = DoEnvironmentSubstW(bufferW, len); + ok(HIWORD(res) && (LOWORD(res) == res2), + " 0: got %d/%d (expected TRUE/%d)\n", HIWORD(res), LOWORD(res), res2); + ok(!lstrcmpW(bufferW, expectedW), + " 0: got %s (expected %s)\n", wine_dbgstr_w(bufferW), wine_dbgstr_w(expectedW)); + + + /* buffer to small */ + /* result: FALSE / provided buffer length / the buffer is untouched */ + memset(bufferA, '#', MAX_PATH - 1); + bufferA[len + 2] = 0; + lstrcpyA(bufferA, names[i]); + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); + + res = DoEnvironmentSubstA(bufferA, len - 1); + ok(!HIWORD(res) && (LOWORD(res) == (len - 1)), + "-1: got %d/%d (expected FALSE/%d)\n", HIWORD(res), LOWORD(res), len - 1); + ok(!lstrcmpA(bufferA, names[i]), + "-1: got %s (expected %s)\n", bufferA, names[i]); + + lstrcpyW(expectedW, bufferW); + res = DoEnvironmentSubstW(bufferW, len - 1); + ok(!HIWORD(res) && (LOWORD(res) == (len - 1)), + "-1: got %d/%d (expected FALSE/%d)\n", HIWORD(res), LOWORD(res), len - 1); + ok(!lstrcmpW(bufferW, expectedW), + "-1: got %s (expected %s)\n", wine_dbgstr_w(bufferW), wine_dbgstr_w(expectedW)); + + + /* unknown variable */ + /* result: TRUE / string length including terminating 0 / the buffer is untouched */ + memset(bufferA, '#', MAX_PATH - 1); + bufferA[MAX_PATH - 1] = 0; + lstrcpyA(bufferA, does_not_existA); + MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR)); + + res2 = lstrlenA(does_not_existA) + 1; + res = DoEnvironmentSubstA(bufferA, MAX_PATH); + ok(HIWORD(res) && (LOWORD(res) == res2), + "%d: got %d/%d (expected TRUE/%d)\n", i, HIWORD(res), LOWORD(res), res2); + ok(!lstrcmpA(bufferA, does_not_existA), + "%d: got %s (expected %s)\n", i, bufferA, does_not_existA); + + res = DoEnvironmentSubstW(bufferW, MAX_PATH); + ok(HIWORD(res) && (LOWORD(res) == res2), + "%d: got %d/%d (expected TRUE/%d)\n", i, HIWORD(res), LOWORD(res), res2); + ok(!lstrcmpW(bufferW, does_not_existW), + "%d: got %s (expected %s)\n", i, wine_dbgstr_w(bufferW), wine_dbgstr_w(does_not_existW)); + + + if (0) + { + /* NULL crashes on windows */ + res = DoEnvironmentSubstA(NULL, MAX_PATH); + res = DoEnvironmentSubstW(NULL, MAX_PATH); + } +} + START_TEST(shellpath) { if (!init()) return; @@ -2522,5 +2673,6 @@ START_TEST(shellpath) test_NonExistentPath(); test_SHGetFolderPathEx(); test_knownFolders(); + test_DoEnvironmentSubst(); } }
1
0
0
0
Detlef Riekenberg : shell32: Fix DoEnvironmentSubstA implementation.
by Alexandre Julliard
05 Dec '12
05 Dec '12
Module: wine Branch: master Commit: 1708adeb97298a3edd5a15f5f72e01fd6619fe51 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1708adeb97298a3edd5a15f5f…
Author: Detlef Riekenberg <wine.dev(a)web.de> Date: Tue Dec 4 11:38:01 2012 +0100 shell32: Fix DoEnvironmentSubstA implementation. --- dlls/shell32/shellord.c | 34 ++++++++++++++-------------------- 1 files changed, 14 insertions(+), 20 deletions(-) diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index b71d213..fcad032 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -1590,39 +1590,33 @@ BOOL WINAPI SHValidateUNC (HWND hwndOwner, PWSTR pszFile, UINT fConnect) } /************************************************************************ - * DoEnvironmentSubstA [SHELL32.@] + * DoEnvironmentSubstA [SHELL32.@] * - * Replace %KEYWORD% in the str with the value of variable KEYWORD - * from environment. If it is not found the %KEYWORD% is left - * intact. If the buffer is too small, str is not modified. - * - * PARAMS - * pszString [I] '\0' terminated string with %keyword%. - * [O] '\0' terminated string with %keyword% substituted. - * cchString [I] size of str. - * - * RETURNS - * cchString length in the HIWORD; - * TRUE in LOWORD if subst was successful and FALSE in other case + * See DoEnvironmentSubstW. */ DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString) { LPSTR dst; BOOL res = FALSE; - FIXME("(%s, %d) stub\n", debugstr_a(pszString), cchString); - if (pszString == NULL) /* Really return 0? */ - return 0; + DWORD len = cchString; + + TRACE("(%s, %d)\n", debugstr_a(pszString), cchString); + if ((dst = HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(CHAR)))) { - DWORD num = ExpandEnvironmentStringsA(pszString, dst, cchString); - if (num && num < cchString) /* dest buffer is too small */ + len = ExpandEnvironmentStringsA(pszString, dst, cchString); + /* len includes the terminating 0 */ + if (len && len < cchString) { res = TRUE; - memcpy(pszString, dst, num); + memcpy(pszString, dst, len); } + else + len = cchString; + HeapFree(GetProcessHeap(), 0, dst); } - return MAKELONG(res,cchString); /* Always cchString? */ + return MAKELONG(len, res); } /************************************************************************
1
0
0
0
← Newer
1
...
44
45
46
47
48
49
50
...
55
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
Results per page:
10
25
50
100
200