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
June
May
April
March
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
October 2012
----- 2025 -----
June 2025
May 2025
April 2025
March 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
960 discussions
Start a n
N
ew thread
Jacek Caban : mshtml: Added IHTMLIFrameElement:: height property implementation.
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: a741a3f99c8835daf59501d55ae09beb26ef9360 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a741a3f99c8835daf59501d55…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 23 13:41:33 2012 +0200 mshtml: Added IHTMLIFrameElement::height property implementation. --- dlls/mshtml/htmliframe.c | 33 +++++++++++++++++++++++++++--- dlls/mshtml/tests/dom.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c index 0e7b218..c1f1264 100644 --- a/dlls/mshtml/htmliframe.c +++ b/dlls/mshtml/htmliframe.c @@ -217,15 +217,40 @@ static HRESULT WINAPI HTMLIFrameElement2_Invoke(IHTMLIFrameElement2 *iface, DISP static HRESULT WINAPI HTMLIFrameElement2_put_height(IHTMLIFrameElement2 *iface, VARIANT v) { HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + nsAString nsstr; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + if(V_VT(&v) != VT_BSTR) { + FIXME("Unsupported %s\n", debugstr_variant(&v)); + return E_NOTIMPL; + } + + nsAString_InitDepend(&nsstr, V_BSTR(&v)); + nsres = nsIDOMHTMLIFrameElement_SetHeight(This->framebase.nsiframe, &nsstr); + nsAString_Finish(&nsstr); + if(NS_FAILED(nsres)) { + ERR("SetHeight failed: %08x\n", nsres); + return E_FAIL; + } + + return S_OK; } static HRESULT WINAPI HTMLIFrameElement2_get_height(IHTMLIFrameElement2 *iface, VARIANT *p) { HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString nsstr; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&nsstr, NULL); + nsres = nsIDOMHTMLIFrameElement_GetHeight(This->framebase.nsiframe, &nsstr); + + V_VT(p) = VT_BSTR; + return return_nsstr(nsres, &nsstr, &V_BSTR(p)); } static HRESULT WINAPI HTMLIFrameElement2_put_width(IHTMLIFrameElement2 *iface, VARIANT v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index ef036da..3c1b0e2 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -878,6 +878,17 @@ static IHTMLLinkElement *_get_link_iface(unsigned line, IUnknown *unk) return ret; } +#define get_iframe2_iface(u) _get_iframe2_iface(__LINE__,u) +static IHTMLIFrameElement2 *_get_iframe2_iface(unsigned line, IUnknown *unk) +{ + IHTMLIFrameElement2 *ret; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLIFrameElement2, (void**)&ret); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLIFrameElement: %08x\n", hres); + return ret; +} + #define test_node_name(u,n) _test_node_name(__LINE__,u,n) static void _test_node_name(unsigned line, IUnknown *unk, const char *exname) { @@ -5239,6 +5250,39 @@ static void test_frame_doc(IUnknown *frame_elem, BOOL iframe) IHTMLDocument2_Release(window_doc); } +#define test_iframe_height(a,b) _test_iframe_height(__LINE__,a,b) +static void _test_iframe_height(unsigned line, IHTMLElement *elem, const char *exval) +{ + IHTMLIFrameElement2 *iframe = _get_iframe2_iface(line, (IUnknown*)elem); + VARIANT v; + HRESULT hres; + + hres = IHTMLIFrameElement2_get_height(iframe, &v); + ok_(__FILE__,line)(hres == S_OK, "get_height failed: %08x\n", hres); + ok_(__FILE__,line)(V_VT(&v) == VT_BSTR, "V_VT(height) = %d\n", V_VT(&v)); + if(exval) + ok_(__FILE__,line)(!strcmp_wa(V_BSTR(&v), exval), "height = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&v)), exval); + else + ok_(__FILE__,line)(!V_BSTR(&v), "height = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + IHTMLIFrameElement2_Release(iframe); +} + +#define set_iframe_height(a,b) _set_iframe_height(__LINE__,a,b) +static void _set_iframe_height(unsigned line, IHTMLElement *elem, const char *val) +{ + IHTMLIFrameElement2 *iframe = _get_iframe2_iface(line, (IUnknown*)elem); + VARIANT v; + HRESULT hres; + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr(val); + hres = IHTMLIFrameElement2_put_height(iframe, v); + ok_(__FILE__,line)(hres == S_OK, "put_height failed: %08x\n", hres); + VariantClear(&v); + IHTMLIFrameElement2_Release(iframe); +} + static void test_iframe_elem(IHTMLElement *elem) { IHTMLDocument2 *content_doc, *owner_doc; @@ -5281,6 +5325,11 @@ static void test_iframe_elem(IHTMLElement *elem) win_skip("IHTMLIFrameElement3 not supported\n"); } + test_iframe_height(elem, NULL); + set_iframe_height(elem, "100px"); + set_iframe_height(elem, "50%"); + test_iframe_height(elem, "50%"); + str = a2bstr("text/html"); V_VT(&errv) = VT_ERROR; disp = NULL;
1
0
0
0
Jacek Caban : mshtml: Added IHTMLStyle::clear property implementation.
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: 04c97d08ebcd6762346bde625a882e1dc75f58b6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=04c97d08ebcd6762346bde625…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 23 13:41:13 2012 +0200 mshtml: Added IHTMLStyle::clear property implementation. --- dlls/mshtml/htmlstyle.c | 15 +++++++++++---- dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/tests/style.c | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index cb164dc..6427bee 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -91,6 +91,8 @@ static const WCHAR attrBorderWidth[] = {'b','o','r','d','e','r','-','w','i','d','t','h',0}; static const WCHAR attrBottom[] = {'b','o','t','t','o','m',0}; +static const WCHAR attrClear[] = + {'c','l','e','a','r',0}; static const WCHAR attrClip[] = {'c','l','i','p',0}; static const WCHAR attrColor[] = @@ -212,6 +214,7 @@ static const style_tbl_entry_t style_tbl[] = { {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH}, {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH}, {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM}, + {attrClear, DISPID_IHTMLSTYLE_CLEAR}, {attrClip, DISPID_IHTMLSTYLE_CLIP}, {attrColor, DISPID_IHTMLSTYLE_COLOR}, {attrCursor, DISPID_IHTMLSTYLE_CURSOR}, @@ -2063,15 +2066,19 @@ static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p) static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + return set_style_attr(This, STYLEID_CLEAR, v, 0); } static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_style_attr(This, STYLEID_CLEAR, p); } static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v) diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index 571931b..0a45e05 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -61,6 +61,7 @@ typedef enum { STYLEID_BORDER_TOP_WIDTH, STYLEID_BORDER_WIDTH, STYLEID_BOTTOM, + STYLEID_CLEAR, STYLEID_CLIP, STYLEID_COLOR, STYLEID_CURSOR, diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index 0584ef4..fd0f78e 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -1910,6 +1910,21 @@ static void test_body_style(IHTMLStyle *style) ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str)); SysFreeString(str); + /* clear */ + hres = IHTMLStyle_get_clear(style, &str); + ok(hres == S_OK, "get_clear failed: %08x\n", hres); + ok(!str, "clear = %s\n", wine_dbgstr_w(str)); + + str = a2bstr("both"); + hres = IHTMLStyle_put_clear(style, str); + ok(hres == S_OK, "put_clear failed: %08x\n", hres); + SysFreeString(str); + + hres = IHTMLStyle_get_clear(style, &str); + ok(hres == S_OK, "get_clear failed: %08x\n", hres); + ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + /* pageBreakAfter */ hres = IHTMLStyle_get_pageBreakAfter(style, &str); ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1
0
0
0
Alexandre Julliard : Revert "winex11: Refuse to set the pixel format for HWND_MESSAGE windows."
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: f950f41bfe821879b9974f204c1f0e7ad26ebf89 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f950f41bfe821879b9974f204…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Oct 23 16:34:57 2012 +0200 Revert "winex11: Refuse to set the pixel format for HWND_MESSAGE windows." This reverts commit 53806917a3fc32460201a40a9edd6d8d24983c25. Tests show that this is allowed. --- dlls/opengl32/tests/opengl.c | 79 ++++++++++++++++++++++++++++++++++++++++++ dlls/winex11.drv/opengl.c | 12 ++---- 2 files changed, 83 insertions(+), 8 deletions(-) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 4f799d2..02a72c8 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -1110,6 +1110,84 @@ static void test_window_dc(void) DestroyWindow(window); } +static void test_message_window(void) +{ + PIXELFORMATDESCRIPTOR pf_desc = + { + sizeof(PIXELFORMATDESCRIPTOR), + 1, /* version */ + PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, + PFD_TYPE_RGBA, + 24, /* 24-bit color depth */ + 0, 0, 0, 0, 0, 0, /* color bits */ + 0, /* alpha buffer */ + 0, /* shift bit */ + 0, /* accumulation buffer */ + 0, 0, 0, 0, /* accum bits */ + 32, /* z-buffer */ + 0, /* stencil buffer */ + 0, /* auxiliary buffer */ + PFD_MAIN_PLANE, /* main layer */ + 0, /* reserved */ + 0, 0, 0 /* layer masks */ + }; + int pixel_format; + HWND window; + RECT vp, r; + HGLRC ctx; + BOOL ret; + HDC dc; + GLenum glerr; + + window = CreateWindowA("static", "opengl32_test", + WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, HWND_MESSAGE, 0, 0, 0); + if (!window) + { + win_skip( "HWND_MESSAGE not supported\n" ); + return; + } + dc = GetDC(window); + ok(!!dc, "Failed to get DC.\n"); + + pixel_format = ChoosePixelFormat(dc, &pf_desc); + if (!pixel_format) + { + win_skip("Failed to find pixel format.\n"); + ReleaseDC(window, dc); + DestroyWindow(window); + return; + } + + ret = SetPixelFormat(dc, pixel_format, &pf_desc); + ok(ret, "Failed to set pixel format, last error %#x.\n", GetLastError()); + + ctx = wglCreateContext(dc); + ok(!!ctx, "Failed to create GL context, last error %#x.\n", GetLastError()); + + ret = wglMakeCurrent(dc, ctx); + ok(ret, "Failed to make context current, last error %#x.\n", GetLastError()); + + GetClientRect(window, &r); + glGetIntegerv(GL_VIEWPORT, (GLint *)&vp); + ok(EqualRect(&r, &vp), "Viewport not equal to client rect.\n"); + + glClear(GL_COLOR_BUFFER_BIT); + glFinish(); + glerr = glGetError(); + ok(glerr == GL_NO_ERROR, "Failed glClear, error %#x.\n", glerr); + ret = SwapBuffers(dc); + ok(ret, "Failed SwapBuffers, error %#x.\n", GetLastError()); + + ret = wglMakeCurrent(NULL, NULL); + ok(ret, "Failed to clear current context, last error %#x.\n", GetLastError()); + + ret = wglDeleteContext(ctx); + ok(ret, "Failed to delete GL context, last error %#x.\n", GetLastError()); + + ReleaseDC(window, dc); + DestroyWindow(window); +} + static void test_destroy(HDC oldhdc) { PIXELFORMATDESCRIPTOR pf_desc = @@ -1458,6 +1536,7 @@ START_TEST(opengl) test_bitmap_rendering( FALSE ); test_minimized(); test_window_dc(); + test_message_window(); test_dc(hwnd, hdc); hglrc = wglCreateContext(hdc); diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 7c30ce0..61aff532 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1170,9 +1170,9 @@ static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl ) gl->drawable = 0; - if (parent == GetDesktopWindow()) /* top-level window */ + if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow()) /* top-level window */ { - Window xparent = X11DRV_get_whole_window( hwnd ); + Window parent = X11DRV_get_whole_window( hwnd ); gl->type = DC_GL_WINDOW; gl->colormap = XCreateColormap( gdi_display, root_window, gl->visual->visual, @@ -1185,8 +1185,8 @@ static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl ) attrib.backing_store = NotUseful; /* put the initial rect outside of the window, it will be moved into place by SetWindowPos */ OffsetRect( &gl->rect, gl->rect.right, gl->rect.bottom ); - if (xparent) - gl->drawable = XCreateWindow( gdi_display, xparent, gl->rect.left, gl->rect.top, + if (parent) + gl->drawable = XCreateWindow( gdi_display, parent, gl->rect.left, gl->rect.top, gl->rect.right - gl->rect.left, gl->rect.bottom - gl->rect.top, 0, default_visual.depth, InputOutput, gl->visual->visual, CWBitGravity | CWWinGravity | CWBackingStore | CWColormap, @@ -1196,10 +1196,6 @@ static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl ) else XFreeColormap( gdi_display, gl->colormap ); } - else if (!GetAncestor( parent, GA_PARENT )) - { - FIXME( "can't set format of HWND_MESSAGE window %p\n", hwnd ); - } #ifdef SONAME_LIBXCOMPOSITE else if(usexcomposite) {
1
0
0
0
Christian Costa : krnl386.exe: If we use operands order of AT&T asm syntax, we' d better use % for registers as in winedbg and GNU assembler to avoid confusion .
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: 2a43bb22618ac4d2a29487414a55cfaac9a6b5a1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2a43bb22618ac4d2a29487414…
Author: Christian Costa <titan.costa(a)gmail.com> Date: Mon Oct 22 21:29:21 2012 +0200 krnl386.exe: If we use operands order of AT&T asm syntax, we'd better use % for registers as in winedbg and GNU assembler to avoid confusion. --- dlls/krnl386.exe16/instr.c | 78 ++++++++++++++++++++++---------------------- 1 files changed, 39 insertions(+), 39 deletions(-) diff --git a/dlls/krnl386.exe16/instr.c b/dlls/krnl386.exe16/instr.c index 5db0b2b..59420ef 100644 --- a/dlls/krnl386.exe16/instr.c +++ b/dlls/krnl386.exe16/instr.c @@ -512,57 +512,57 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context ) case 0x0f: /* extended instruction */ switch(instr[1]) { - case 0x22: /* mov eax, crX */ + case 0x22: /* mov %eax, %crX */ switch (instr[2]) { - case 0xc0: - ERR("mov eax,cr0 at 0x%08x, EAX=0x%08x\n", - context->Eip,context->Eax ); + case 0xc0: + ERR("mov %%eax, %%cr0 at 0x%08x, EAX=0x%08x\n", + context->Eip,context->Eax ); context->Eip += prefixlen+3; - return ExceptionContinueExecution; - default: - break; /*fallthrough to bad instruction handling */ - } - break; /*fallthrough to bad instruction handling */ - case 0x20: /* mov crX, eax */ + return ExceptionContinueExecution; + default: + break; /* Fallthrough to bad instruction handling */ + } + break; /* Fallthrough to bad instruction handling */ + case 0x20: /* mov %crX, %eax */ switch (instr[2]) { - case 0xe0: /* mov cr4, eax */ - /* CR4 register . See linux/arch/i386/mm/init.c, X86_CR4_ defs - * bit 0: VME Virtual Mode Exception ? - * bit 1: PVI Protected mode Virtual Interrupt - * bit 2: TSD Timestamp disable - * bit 3: DE Debugging extensions - * bit 4: PSE Page size extensions - * bit 5: PAE Physical address extension - * bit 6: MCE Machine check enable - * bit 7: PGE Enable global pages - * bit 8: PCE Enable performance counters at IPL3 - */ - ERR("mov cr4,eax at 0x%08x\n",context->Eip); + case 0xe0: /* mov %cr4, %eax */ + /* CR4 register: See linux/arch/i386/mm/init.c, X86_CR4_ defs + * bit 0: VME Virtual Mode Exception ? + * bit 1: PVI Protected mode Virtual Interrupt + * bit 2: TSD Timestamp disable + * bit 3: DE Debugging extensions + * bit 4: PSE Page size extensions + * bit 5: PAE Physical address extension + * bit 6: MCE Machine check enable + * bit 7: PGE Enable global pages + * bit 8: PCE Enable performance counters at IPL3 + */ + ERR("mov %%cr4, %%eax at 0x%08x\n",context->Eip); context->Eax = 0; context->Eip += prefixlen+3; - return ExceptionContinueExecution; - case 0xc0: /* mov cr0, eax */ - ERR("mov cr0,eax at 0x%08x\n",context->Eip); + return ExceptionContinueExecution; + case 0xc0: /* mov %cr0, %eax */ + ERR("mov %%cr0, %%eax at 0x%08x\n",context->Eip); context->Eax = 0x10; /* FIXME: set more bits ? */ context->Eip += prefixlen+3; - return ExceptionContinueExecution; - default: /* fallthrough to illegal instruction */ - break; - } - /* fallthrough to illegal instruction */ - break; - case 0x21: /* mov drX, eax */ + return ExceptionContinueExecution; + default: /* Fallthrough to illegal instruction */ + break; + } + /* Fallthrough to illegal instruction */ + break; + case 0x21: /* mov %drX, %eax */ switch (instr[2]) { - case 0xc8: /* mov dr1, eax */ - TRACE("mov dr1,eax at 0x%08x\n",context->Eip); + case 0xc8: /* mov %dr1, %eax */ + TRACE("mov %%dr1, %%eax at 0x%08x\n",context->Eip); context->Eax = context->Dr1; context->Eip += prefixlen+3; return ExceptionContinueExecution; - case 0xf8: /* mov dr7, eax */ - TRACE("mov dr7,eax at 0x%08x\n",context->Eip); + case 0xf8: /* mov %dr7, %eax */ + TRACE("mov %%dr7, %%eax at 0x%08x\n",context->Eip); context->Eax = 0x400; context->Eip += prefixlen+3; return ExceptionContinueExecution; @@ -570,10 +570,10 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context ) ERR("Unsupported DR register, eip+2 is %02x\n", instr[2]); /* fallthrough to illegal instruction */ break; - case 0x23: /* mov eax drX */ + case 0x23: /* mov %eax, %drX */ switch (instr[2]) { - case 0xc8: /* mov eax, dr1 */ + case 0xc8: /* mov %eax, %dr1 */ context->Dr1 = context->Eax; context->Eip += prefixlen+3; return ExceptionContinueExecution;
1
0
0
0
Christian Costa : d3dxof/tests: Document dump function and rename X files with .x extension.
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: 834512f186b9138d8e43dbc86b7da3cc74fdf742 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=834512f186b9138d8e43dbc86…
Author: Christian Costa <titan.costa(a)gmail.com> Date: Mon Oct 22 21:39:19 2012 +0200 d3dxof/tests: Document dump function and rename X files with .x extension. --- dlls/d3dxof/tests/d3dxof.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c index 6361317..182bf33 100644 --- a/dlls/d3dxof/tests/d3dxof.c +++ b/dlls/d3dxof/tests/d3dxof.c @@ -706,6 +706,8 @@ static void process_data(LPDIRECTXFILEDATA lpDirectXFileData, int* plevel) ok(hr == DXFILE_OK || hr == DXFILEERR_NOMOREOBJECTS, "IDirectXFileData_GetNextObject: %x\n", hr); } +/* Dump an X file 'objects.x' and its related templates file 'templates.x' if they are both presents + * Useful for debug by comparing outputs from native and builtin dlls */ static void test_dump(void) { HRESULT hr; @@ -724,12 +726,12 @@ static void test_dump(void) } /* Dump data only if there is an object and a template */ - hFile = CreateFileA("objects.txt", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + hFile = CreateFileA("objects.x", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) return; CloseHandle(hFile); - hFile = CreateFileA("templates.txt", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + hFile = CreateFileA("templates.x", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) return;
1
0
0
0
Nikolay Sivov : dwrite: Separate format data and keep it in both layout and text format.
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: 2e977e112fc96f1d3eead6f67ae19c3664b2ab8d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2e977e112fc96f1d3eead6f67…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 23 08:32:34 2012 -0400 dwrite: Separate format data and keep it in both layout and text format. --- dlls/dwrite/layout.c | 54 +++++++++++++++++++++++++++++-------------------- 1 files changed, 32 insertions(+), 22 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 91360ee..a2d1ef9 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -32,17 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite); -struct dwrite_textlayout { - IDWriteTextLayout IDWriteTextLayout_iface; - LONG ref; - - WCHAR *str; -}; - -struct dwrite_textformat { - IDWriteTextFormat IDWriteTextFormat_iface; - LONG ref; - +struct dwrite_textformat_data { WCHAR *family_name; WCHAR *locale; @@ -55,6 +45,27 @@ struct dwrite_textformat { IDWriteFontCollection *collection; }; +struct dwrite_textlayout { + IDWriteTextLayout IDWriteTextLayout_iface; + LONG ref; + + WCHAR *str; + struct dwrite_textformat_data format; +}; + +struct dwrite_textformat { + IDWriteTextFormat IDWriteTextFormat_iface; + LONG ref; + struct dwrite_textformat_data format; +}; + +static void release_format_data(struct dwrite_textformat_data *data) +{ + if (data->collection) IDWriteFontCollection_Release(data->collection); + heap_free(data->family_name); + heap_free(data->locale); +} + static inline struct dwrite_textlayout *impl_from_IDWriteTextLayout(IDWriteTextLayout *iface) { return CONTAINING_RECORD(iface, struct dwrite_textlayout, IDWriteTextLayout_iface); @@ -665,6 +676,7 @@ HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextLayout **layo This->IDWriteTextLayout_iface.lpVtbl = &dwritetextlayoutvtbl; This->ref = 1; This->str = heap_strdupnW(str, len); + memset(&This->format, 0, sizeof(This->format)); *layout = &This->IDWriteTextLayout_iface; @@ -707,9 +719,7 @@ static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat *iface) if (!ref) { - if (This->collection) IDWriteFontCollection_Release(This->collection); - heap_free(This->family_name); - heap_free(This->locale); + release_format_data(&This->format); heap_free(This); } @@ -838,7 +848,7 @@ static HRESULT WINAPI dwritetextformat_GetFontCollection(IDWriteTextFormat *ifac TRACE("(%p)->(%p)\n", This, collection); - *collection = This->collection; + *collection = This->format.collection; IDWriteFontCollection_AddRef(*collection); return S_OK; @@ -943,20 +953,20 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle This->IDWriteTextFormat_iface.lpVtbl = &dwritetextformatvtbl; This->ref = 1; - This->family_name = heap_strdupW(family_name); - This->locale = heap_strdupW(locale); - This->weight = weight; - This->style = style; - This->size = size; + This->format.family_name = heap_strdupW(family_name); + This->format.locale = heap_strdupW(locale); + This->format.weight = weight; + This->format.style = style; + This->format.size = size; if (collection) { - This->collection = collection; + This->format.collection = collection; IDWriteFontCollection_AddRef(collection); } else { - HRESULT hr = get_system_fontcollection(&This->collection); + HRESULT hr = get_system_fontcollection(&This->format.collection); if (hr != S_OK) { IDWriteTextFormat_Release(&This->IDWriteTextFormat_iface);
1
0
0
0
Nikolay Sivov : dwrite: Added basic GetFirstMatchingFont() for font family.
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: 22508806fc8c2abef7816c4f5c06dc0917a6e5f3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=22508806fc8c2abef7816c4f5…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 23 08:18:32 2012 -0400 dwrite: Added basic GetFirstMatchingFont() for font family. --- dlls/dwrite/font.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index bdc84ee..4b697e9 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -607,8 +607,16 @@ static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily *i DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, IDWriteFont **font) { struct dwrite_fontfamily *This = impl_from_IDWriteFontFamily(iface); - FIXME("(%p)->(%d %d %d %p): stub\n", This, weight, stretch, style, font); - return E_NOTIMPL; + LOGFONTW lf; + + TRACE("(%p)->(%d %d %d %p)\n", This, weight, stretch, style, font); + + memset(&lf, 0, sizeof(lf)); + lf.lfWeight = weight; + lf.lfItalic = style == DWRITE_FONT_STYLE_ITALIC; + strcpyW(lf.lfFaceName, This->familyname); + + return create_font_from_logfont(&lf, font); } static HRESULT WINAPI dwritefontfamily_GetMatchingFonts(IDWriteFontFamily *iface, DWRITE_FONT_WEIGHT weight,
1
0
0
0
Nikolay Sivov : dwrite: Implement GetFontFamily() for system font collection.
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: 10431905e50baa8d0b3ffaf50b9af3a34bf57157 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=10431905e50baa8d0b3ffaf50…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Oct 22 00:06:03 2012 -0400 dwrite: Implement GetFontFamily() for system font collection. --- dlls/dwrite/font.c | 14 ++++++++++++-- dlls/dwrite/tests/font.c | 7 +++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 60aa7db..bdc84ee 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -161,6 +161,8 @@ struct dwrite_fontface { LONG ref; }; +static HRESULT create_fontfamily(const WCHAR *familyname, IDWriteFontFamily **family); + static inline struct dwrite_fontface *impl_from_IDWriteFontFace(IDWriteFontFace *iface) { return CONTAINING_RECORD(iface, struct dwrite_fontface, IDWriteFontFace_iface); @@ -666,8 +668,16 @@ static UINT32 WINAPI dwritefontcollection_GetFontFamilyCount(IDWriteFontCollecti static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection *iface, UINT32 index, IDWriteFontFamily **family) { struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection(iface); - FIXME("(%p)->(%u %p): stub\n", This, index, family); - return E_NOTIMPL; + + TRACE("(%p)->(%u %p)\n", This, index, family); + + if (index >= This->count) + { + *family = NULL; + return E_FAIL; + } + + return create_fontfamily(This->families[index], family); } static HRESULT WINAPI dwritefontcollection_FindFamilyName(IDWriteFontCollection *iface, const WCHAR *name, UINT32 *index, BOOL *exists) diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 423c876..dde50eb 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -526,6 +526,7 @@ todo_wine static void test_system_fontcollection(void) { IDWriteFontCollection *collection, *coll2; + IDWriteFontFamily *family; HRESULT hr; UINT32 i; BOOL ret; @@ -546,6 +547,12 @@ static void test_system_fontcollection(void) i = IDWriteFontCollection_GetFontFamilyCount(collection); ok(i, "got %u\n", i); + /* invalid index */ + family = (void*)0xdeadbeef; + hr = IDWriteFontCollection_GetFontFamily(collection, i, &family); + ok(hr == E_FAIL, "got 0x%08x\n", hr); + ok(family == NULL, "got %p\n", family); + ret = FALSE; i = (UINT32)-1; hr = IDWriteFontCollection_FindFamilyName(collection, tahomaW, &i, &ret);
1
0
0
0
Nikolay Sivov : dwrite: Implement IDWriteTextFormat::GetFontCollection().
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: a30faec10ebce7c8c4c1fc2dc96ba6edbd5911a5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a30faec10ebce7c8c4c1fc2dc…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Oct 21 23:49:27 2012 -0400 dwrite: Implement IDWriteTextFormat::GetFontCollection(). --- dlls/dwrite/dwrite_private.h | 2 +- dlls/dwrite/layout.c | 31 ++++++++++++++++++++++++++++--- dlls/dwrite/main.c | 6 +----- dlls/dwrite/tests/layout.c | 30 +++++++++++++++++++++++++++++- 4 files changed, 59 insertions(+), 10 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index e9d927a..7216393 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -68,7 +68,7 @@ static inline LPWSTR heap_strdupnW(const WCHAR *str, UINT32 len) } extern HRESULT create_font_from_logfont(const LOGFONTW*, IDWriteFont**) DECLSPEC_HIDDEN; -extern HRESULT create_textformat(const WCHAR*,DWRITE_FONT_WEIGHT,DWRITE_FONT_STYLE,DWRITE_FONT_STRETCH, +extern HRESULT create_textformat(const WCHAR*,IDWriteFontCollection*,DWRITE_FONT_WEIGHT,DWRITE_FONT_STYLE,DWRITE_FONT_STRETCH, FLOAT,const WCHAR*,IDWriteTextFormat**) DECLSPEC_HIDDEN; extern HRESULT create_textlayout(const WCHAR*,UINT32,IDWriteTextLayout**) DECLSPEC_HIDDEN; extern HRESULT create_gdiinterop(IDWriteGdiInterop**) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 760ebb2..91360ee 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -51,6 +51,8 @@ struct dwrite_textformat { DWRITE_FONT_STRETCH stretch; FLOAT size; + + IDWriteFontCollection *collection; }; static inline struct dwrite_textlayout *impl_from_IDWriteTextLayout(IDWriteTextLayout *iface) @@ -705,6 +707,7 @@ static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat *iface) if (!ref) { + if (This->collection) IDWriteFontCollection_Release(This->collection); heap_free(This->family_name); heap_free(This->locale); heap_free(This); @@ -832,8 +835,13 @@ static HRESULT WINAPI dwritetextformat_GetLineSpacing(IDWriteTextFormat *iface, static HRESULT WINAPI dwritetextformat_GetFontCollection(IDWriteTextFormat *iface, IDWriteFontCollection **collection) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface); - FIXME("(%p)->(%p): stub\n", This, collection); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, collection); + + *collection = This->collection; + IDWriteFontCollection_AddRef(*collection); + + return S_OK; } static UINT32 WINAPI dwritetextformat_GetFontFamilyNameLength(IDWriteTextFormat *iface) @@ -923,11 +931,13 @@ static const IDWriteTextFormatVtbl dwritetextformatvtbl = { dwritetextformat_GetLocaleName }; -HRESULT create_textformat(const WCHAR *family_name, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style, +HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *collection, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style, DWRITE_FONT_STRETCH stretch, FLOAT size, const WCHAR *locale, IDWriteTextFormat **format) { struct dwrite_textformat *This; + *format = NULL; + This = heap_alloc(sizeof(struct dwrite_textformat)); if (!This) return E_OUTOFMEMORY; @@ -939,6 +949,21 @@ HRESULT create_textformat(const WCHAR *family_name, DWRITE_FONT_WEIGHT weight, D This->style = style; This->size = size; + if (collection) + { + This->collection = collection; + IDWriteFontCollection_AddRef(collection); + } + else + { + HRESULT hr = get_system_fontcollection(&This->collection); + if (hr != S_OK) + { + IDWriteTextFormat_Release(&This->IDWriteTextFormat_iface); + return hr; + } + } + *format = &This->IDWriteTextFormat_iface; return S_OK; diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index ea1bbce..09ed3f2 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -488,11 +488,7 @@ static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory *iface, WCHA { TRACE("(%s %p %d %d %d %f %s %p)\n", debugstr_w(family_name), collection, weight, style, stretch, size, debugstr_w(locale), format); - - if (collection) - FIXME("font collection not supported\n"); - - return create_textformat(family_name, weight, style, stretch, size, locale, format); + return create_textformat(family_name, collection, weight, style, stretch, size, locale, format); } static HRESULT WINAPI dwritefactory_CreateTypography(IDWriteFactory *iface, IDWriteTypography **typography) diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index ab29c06..6b8dc62 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -28,6 +28,7 @@ static IDWriteFactory *factory; static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0}; +static const WCHAR enusW[] = {'e','n','-','u','s',0}; #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__) static void _expect_ref(IUnknown* obj, ULONG ref, int line) @@ -62,7 +63,6 @@ static void test_CreateTextLayout(void) static void test_CreateGdiCompatibleTextLayout(void) { static const WCHAR strW[] = {'s','t','r','i','n','g',0}; - static const WCHAR enusW[] = {'e','n','-','u','s',0}; IDWriteTextLayout *layout; IDWriteTextFormat *format; HRESULT hr; @@ -107,6 +107,33 @@ static void test_CreateGdiCompatibleTextLayout(void) IDWriteTextFormat_Release(format); } +static void test_CreateTextFormat(void) +{ + IDWriteFontCollection *collection, *syscoll; + IDWriteTextFormat *format; + HRESULT hr; + + hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, + DWRITE_FONT_STRETCH_NORMAL, 10.0, enusW, &format); + ok(hr == S_OK, "got 0x%08x\n", hr); + +if (0) /* crashes on native */ + hr = IDWriteTextFormat_GetFontCollection(format, NULL); + + collection = NULL; + hr = IDWriteTextFormat_GetFontCollection(format, &collection); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(collection != NULL, "got %p\n", collection); + + hr = IDWriteFactory_GetSystemFontCollection(factory, &syscoll, FALSE); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(collection == syscoll, "got %p, was %p\n", syscoll, collection); + IDWriteFontCollection_Release(syscoll); + IDWriteFontCollection_Release(collection); + + IDWriteTextFormat_Release(format); +} + START_TEST(layout) { HRESULT hr; @@ -121,6 +148,7 @@ START_TEST(layout) test_CreateTextLayout(); test_CreateGdiCompatibleTextLayout(); + test_CreateTextFormat(); IDWriteFactory_Release(factory); }
1
0
0
0
Nikolay Sivov : dwrite: Keep a single instance of system font collection.
by Alexandre Julliard
23 Oct '12
23 Oct '12
Module: wine Branch: master Commit: a291a7adf8f92e97e3bb9365008b0fc28d17a773 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a291a7adf8f92e97e3bb93650…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Oct 21 23:20:42 2012 -0400 dwrite: Keep a single instance of system font collection. --- dlls/dwrite/dwrite_private.h | 3 +- dlls/dwrite/font.c | 97 +++++++++++++++++++++-------------------- dlls/dwrite/main.c | 5 ++- dlls/dwrite/tests/font.c | 12 +++++- 4 files changed, 67 insertions(+), 50 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 4cb0e3b..e9d927a 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -74,4 +74,5 @@ extern HRESULT create_textlayout(const WCHAR*,UINT32,IDWriteTextLayout**) DECLSP extern HRESULT create_gdiinterop(IDWriteGdiInterop**) DECLSPEC_HIDDEN; extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDEN; extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; -extern HRESULT create_system_fontcollection(IDWriteFontCollection**) DECLSPEC_HIDDEN; +extern HRESULT get_system_fontcollection(IDWriteFontCollection**) DECLSPEC_HIDDEN; +extern void release_system_fontcollection(void) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index ff4a345..60aa7db 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -129,13 +129,14 @@ typedef struct struct dwrite_fontcollection { IDWriteFontCollection IDWriteFontCollection_iface; - LONG ref; WCHAR **families; UINT32 count; int alloc; }; +static IDWriteFontCollection *system_collection; + struct dwrite_fontfamily { IDWriteFontFamily IDWriteFontFamily_iface; LONG ref; @@ -645,32 +646,14 @@ static HRESULT WINAPI dwritefontcollection_QueryInterface(IDWriteFontCollection return E_NOINTERFACE; } -static ULONG WINAPI dwritefontcollection_AddRef(IDWriteFontCollection *iface) +static ULONG WINAPI dwritesysfontcollection_AddRef(IDWriteFontCollection *iface) { - struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection(iface); - ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p)->(%d)\n", This, ref); - return ref; + return 2; } -static ULONG WINAPI dwritefontcollection_Release(IDWriteFontCollection *iface) +static ULONG WINAPI dwritesysfontcollection_Release(IDWriteFontCollection *iface) { - struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection(iface); - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("(%p)->(%d)\n", This, ref); - - if (!ref) - { - int i; - - for (i = 0; i < This->count; i++) - heap_free(This->families[i]); - heap_free(This->families); - heap_free(This); - } - - return ref; + return 1; } static UINT32 WINAPI dwritefontcollection_GetFontFamilyCount(IDWriteFontCollection *iface) @@ -715,10 +698,10 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec return E_NOTIMPL; } -static const IDWriteFontCollectionVtbl fontcollectionvtbl = { +static const IDWriteFontCollectionVtbl systemfontcollectionvtbl = { dwritefontcollection_QueryInterface, - dwritefontcollection_AddRef, - dwritefontcollection_Release, + dwritesysfontcollection_AddRef, + dwritesysfontcollection_Release, dwritefontcollection_GetFontFamilyCount, dwritefontcollection_GetFontFamily, dwritefontcollection_FindFamilyName, @@ -749,35 +732,55 @@ static INT CALLBACK enum_font_families(const LOGFONTW *lf, const TEXTMETRICW *tm return add_family_syscollection(collection, lf->lfFaceName) == S_OK; } -HRESULT create_system_fontcollection(IDWriteFontCollection **collection) +static void release_font_collection(IDWriteFontCollection *iface) { - struct dwrite_fontcollection *This; - LOGFONTW lf; - HDC hdc; + struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection(iface); + int i; - *collection = NULL; + for (i = 0; i < This->count; i++) + heap_free(This->families[i]); + heap_free(This->families); + heap_free(This); +} - This = heap_alloc(sizeof(struct dwrite_fontcollection)); - if (!This) return E_OUTOFMEMORY; +void release_system_fontcollection(void) +{ + release_font_collection(system_collection); +} - This->IDWriteFontCollection_iface.lpVtbl = &fontcollectionvtbl; - This->ref = 1; +HRESULT get_system_fontcollection(IDWriteFontCollection **collection) +{ + if (!system_collection) + { + struct dwrite_fontcollection *This; + LOGFONTW lf; + HDC hdc; - This->alloc = 50; - This->count = 0; - This->families = heap_alloc(This->alloc*sizeof(WCHAR*)); + *collection = NULL; - TRACE("building system font collection:\n"); + This = heap_alloc(sizeof(struct dwrite_fontcollection)); + if (!This) return E_OUTOFMEMORY; - hdc = CreateCompatibleDC(0); - memset(&lf, 0, sizeof(lf)); - lf.lfCharSet = DEFAULT_CHARSET; - lf.lfPitchAndFamily = DEFAULT_PITCH; - lf.lfFaceName[0] = 0; - EnumFontFamiliesExW(hdc, &lf, enum_font_families, (LPARAM)This, 0); - DeleteDC(hdc); + This->IDWriteFontCollection_iface.lpVtbl = &systemfontcollectionvtbl; + This->alloc = 50; + This->count = 0; + This->families = heap_alloc(This->alloc*sizeof(WCHAR*)); + + TRACE("building system font collection:\n"); + + hdc = CreateCompatibleDC(0); + memset(&lf, 0, sizeof(lf)); + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfPitchAndFamily = DEFAULT_PITCH; + lf.lfFaceName[0] = 0; + EnumFontFamiliesExW(hdc, &lf, enum_font_families, (LPARAM)This, 0); + DeleteDC(hdc); + + if (InterlockedCompareExchangePointer((void**)&system_collection, &This->IDWriteFontCollection_iface, NULL)) + release_font_collection(&This->IDWriteFontCollection_iface); + } - *collection = &This->IDWriteFontCollection_iface; + *collection = system_collection; return S_OK; } diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 4605008..ea1bbce 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -43,6 +43,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved) case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinstDLL ); break; + case DLL_PROCESS_DETACH: + release_system_fontcollection(); + break; } return TRUE; } @@ -389,7 +392,7 @@ static HRESULT WINAPI dwritefactory_GetSystemFontCollection(IDWriteFactory *ifac if (check_for_updates) FIXME("checking for system font updates not implemented\n"); - return create_system_fontcollection(collection); + return get_system_fontcollection(collection); } static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory *iface, diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 07d3e7d..423c876 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -525,7 +525,7 @@ todo_wine static void test_system_fontcollection(void) { - IDWriteFontCollection *collection; + IDWriteFontCollection *collection, *coll2; HRESULT hr; UINT32 i; BOOL ret; @@ -533,6 +533,16 @@ static void test_system_fontcollection(void) hr = IDWriteFactory_GetSystemFontCollection(factory, &collection, FALSE); ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IDWriteFactory_GetSystemFontCollection(factory, &coll2, FALSE); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(coll2 == collection, "got %p, was %p\n", coll2, collection); + IDWriteFontCollection_Release(coll2); + + hr = IDWriteFactory_GetSystemFontCollection(factory, &coll2, TRUE); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(coll2 == collection, "got %p, was %p\n", coll2, collection); + IDWriteFontCollection_Release(coll2); + i = IDWriteFontCollection_GetFontFamilyCount(collection); ok(i, "got %u\n", i);
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
29
...
96
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Results per page:
10
25
50
100
200