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
July
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
September 2012
----- 2025 -----
July 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
828 discussions
Start a n
N
ew thread
Alexandre Julliard : winex11: Get the current pixel format from the drawable structure in wglMakeCurrent .
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 11013af0a1a7f9c7d4854c376f8a3b46f955f1e2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=11013af0a1a7f9c7d4854c376…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Sep 7 15:53:00 2012 +0200 winex11: Get the current pixel format from the drawable structure in wglMakeCurrent. --- dlls/winex11.drv/opengl.c | 57 +++++++++++++++++++-------------------------- 1 files changed, 24 insertions(+), 33 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 97055ae..a6fb974 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1662,8 +1662,9 @@ static PROC glxdrv_wglGetProcAddress(LPCSTR lpszProc) */ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) { - BOOL ret; - struct x11drv_escape_get_drawable escape; + BOOL ret = FALSE; + HWND hwnd; + struct gl_drawable *gl; TRACE("(%p,%p)\n", hdc, ctx); @@ -1674,51 +1675,41 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) return TRUE; } - escape.code = X11DRV_GET_DRAWABLE; - if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape.code), (LPCSTR)&escape.code, - sizeof(escape), (LPSTR)&escape )) - return FALSE; + hwnd = WindowFromDC( hdc ); + EnterCriticalSection( &context_section ); - if (!escape.pixel_format) - { - WARN("Trying to use an invalid drawable\n"); - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - if (ctx->fmt - pixel_formats != escape.pixel_format - 1) - { - WARN( "mismatched pixel format hdc %p %u ctx %p\n", hdc, escape.pixel_format, ctx ); - SetLastError( ERROR_INVALID_PIXEL_FORMAT ); - return FALSE; - } - else + if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl ) || + !XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&gl )) { + if (ctx->fmt != gl->format) + { + WARN( "mismatched pixel format hdc %p %p ctx %p %p\n", hdc, gl->format, ctx, ctx->fmt ); + SetLastError( ERROR_INVALID_PIXEL_FORMAT ); + goto done; + } + if (TRACE_ON(wgl)) { - int vis_id; - pglXGetFBConfigAttrib(gdi_display, ctx->fmt->fbconfig, GLX_VISUAL_ID, &vis_id); describeContext(ctx); - TRACE("hdc %p drawable %lx fmt %u vis %x ctx %p\n", hdc, - escape.gl_drawable, escape.pixel_format, vis_id, ctx->ctx); + TRACE("hdc %p drawable %lx fmt %p ctx %p\n", hdc, gl->drawable, gl->format, ctx->ctx ); } - ret = pglXMakeCurrent(gdi_display, escape.gl_drawable, ctx->ctx); - + ret = pglXMakeCurrent(gdi_display, gl->drawable, ctx->ctx); if (ret) { NtCurrentTeb()->glContext = ctx; - - EnterCriticalSection( &context_section ); ctx->has_been_current = TRUE; ctx->hdc = hdc; - ctx->drawables[0] = escape.gl_drawable; - ctx->drawables[1] = escape.gl_drawable; + ctx->drawables[0] = gl->drawable; + ctx->drawables[1] = gl->drawable; ctx->refresh_drawables = FALSE; - LeaveCriticalSection( &context_section ); + goto done; } - else - SetLastError(ERROR_INVALID_HANDLE); } - TRACE(" returning %s\n", (ret ? "True" : "False")); + SetLastError( ERROR_INVALID_HANDLE ); + +done: + LeaveCriticalSection( &context_section ); + TRACE( "%p,%p returning %d\n", hdc, ctx, ret ); return ret; }
1
0
0
0
Alexandre Julliard : winex11: Get the current pixel format from the drawable structure in wglCreateContextAttribsARB .
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: d52c2de7dad0a5f0f9cbcc5115360028f390d4a7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d52c2de7dad0a5f0f9cbcc511…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Sep 7 16:19:06 2012 +0200 winex11: Get the current pixel format from the drawable structure in wglCreateContextAttribsARB. --- dlls/winex11.drv/opengl.c | 93 +++++++++++++++++++------------------------- 1 files changed, 40 insertions(+), 53 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index dccee22..97055ae 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1880,90 +1880,77 @@ static void wglFlush(void) static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wgl_context *hShareContext, const int* attribList ) { - struct x11drv_escape_get_drawable escape; - struct wgl_context *ret; - const struct wgl_pixel_format *fmt; + struct wgl_context *ret = NULL; + struct gl_drawable *gl; + HWND hwnd = WindowFromDC( hdc ); TRACE("(%p %p %p)\n", hdc, hShareContext, attribList); - escape.code = X11DRV_GET_DRAWABLE; - if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape.code), (LPCSTR)&escape.code, - sizeof(escape), (LPSTR)&escape )) - return 0; - - fmt = get_pixel_format(gdi_display, escape.pixel_format, TRUE /* Offscreen */); - /* wglCreateContextAttribsARB supports ALL pixel formats, so also offscreen ones. - * If this fails something is very wrong on the system. */ - if(!fmt) - { - ERR("Cannot get FB Config for iPixelFormat %d, expect problems!\n", escape.pixel_format); - SetLastError(ERROR_INVALID_PIXEL_FORMAT); - return NULL; - } - - if (!(ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret)))) return 0; - - ret->hdc = hdc; - ret->fmt = fmt; - ret->vis = NULL; /* glXCreateContextAttribsARB requires a fbconfig instead of a visual */ - ret->gl3_context = TRUE; + EnterCriticalSection( &context_section ); - ret->numAttribs = 0; - if(attribList) + if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl ) || + !XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&gl )) { - int *pAttribList = (int*)attribList; - int *pContextAttribList = &ret->attribList[0]; - /* attribList consists of pairs {token, value] terminated with 0 */ - while(pAttribList[0] != 0) + if (!(ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret)))) goto done; + ret->hdc = hdc; + ret->fmt = gl->format; + ret->vis = NULL; /* glXCreateContextAttribsARB requires a fbconfig instead of a visual */ + ret->gl3_context = TRUE; + ret->numAttribs = 0; + if (attribList) { - TRACE("%#x %#x\n", pAttribList[0], pAttribList[1]); - switch(pAttribList[0]) + int *pContextAttribList = &ret->attribList[0]; + /* attribList consists of pairs {token, value] terminated with 0 */ + while(attribList[0] != 0) { + TRACE("%#x %#x\n", attribList[0], attribList[1]); + switch(attribList[0]) + { case WGL_CONTEXT_MAJOR_VERSION_ARB: pContextAttribList[0] = GLX_CONTEXT_MAJOR_VERSION_ARB; - pContextAttribList[1] = pAttribList[1]; + pContextAttribList[1] = attribList[1]; break; case WGL_CONTEXT_MINOR_VERSION_ARB: pContextAttribList[0] = GLX_CONTEXT_MINOR_VERSION_ARB; - pContextAttribList[1] = pAttribList[1]; + pContextAttribList[1] = attribList[1]; break; case WGL_CONTEXT_LAYER_PLANE_ARB: break; case WGL_CONTEXT_FLAGS_ARB: pContextAttribList[0] = GLX_CONTEXT_FLAGS_ARB; - pContextAttribList[1] = pAttribList[1]; + pContextAttribList[1] = attribList[1]; break; case WGL_CONTEXT_PROFILE_MASK_ARB: pContextAttribList[0] = GLX_CONTEXT_PROFILE_MASK_ARB; - pContextAttribList[1] = pAttribList[1]; + pContextAttribList[1] = attribList[1]; break; default: - ERR("Unhandled attribList pair: %#x %#x\n", pAttribList[0], pAttribList[1]); + ERR("Unhandled attribList pair: %#x %#x\n", attribList[0], attribList[1]); + } + ret->numAttribs++; + attribList += 2; + pContextAttribList += 2; } - - ret->numAttribs++; - pAttribList += 2; - pContextAttribList += 2; } - } - - X11DRV_expect_error(gdi_display, GLXErrorHandler, NULL); - ret->ctx = create_glxcontext(gdi_display, ret, NULL); - XSync(gdi_display, False); - if(X11DRV_check_error() || !ret->ctx) - { + X11DRV_expect_error(gdi_display, GLXErrorHandler, NULL); + ret->ctx = create_glxcontext(gdi_display, ret, NULL); + XSync(gdi_display, False); + if (!X11DRV_check_error() && ret->ctx) + { + list_add_head( &context_list, &ret->entry ); + goto done; + } /* In the future we should convert the GLX error to a win32 one here if needed */ ERR("Context creation failed\n"); HeapFree( GetProcessHeap(), 0, ret ); - return NULL; + ret = NULL; } + else SetLastError( ERROR_INVALID_PIXEL_FORMAT ); - EnterCriticalSection( &context_section ); - list_add_head( &context_list, &ret->entry ); +done: LeaveCriticalSection( &context_section ); - - TRACE(" creating context %p\n", ret); + TRACE( "%p -> %p\n", hdc, ret ); return ret; }
1
0
0
0
Alexandre Julliard : winex11: Get the current pixel format from the drawable structure in wglCreateContext .
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: c01d723a4fd91fbde6d9dc201329be3c2cccdea2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c01d723a4fd91fbde6d9dc201…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Sep 7 15:43:01 2012 +0200 winex11: Get the current pixel format from the drawable structure in wglCreateContext. --- dlls/winex11.drv/opengl.c | 48 +++++++++++++++------------------------------ 1 files changed, 16 insertions(+), 32 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 3c557db..dccee22 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1608,43 +1608,27 @@ static BOOL glxdrv_wglCopyContext(struct wgl_context *src, struct wgl_context *d */ static struct wgl_context *glxdrv_wglCreateContext( HDC hdc ) { - struct x11drv_escape_get_drawable escape; - struct wgl_context *ret; - const struct wgl_pixel_format *fmt; - - TRACE( "(%p)\n", hdc ); + struct wgl_context *ret = NULL; + struct gl_drawable *gl; + HWND hwnd = WindowFromDC( hdc ); - escape.code = X11DRV_GET_DRAWABLE; - if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape.code), (LPCSTR)&escape.code, - sizeof(escape), (LPSTR)&escape )) - return 0; + EnterCriticalSection( &context_section ); - fmt = get_pixel_format(gdi_display, escape.pixel_format, TRUE /* Offscreen */); - /* We can render using the iPixelFormat (1) of Wine's Main visual AND using some offscreen formats. - * Note that standard WGL-calls don't recognize offscreen-only formats. For that reason pbuffers - * use a sort of 'proxy' HDC (wglGetPbufferDCARB). - * If this fails something is very wrong on the system. */ - if(!fmt) { - ERR("Cannot get FB Config for iPixelFormat %d, expect problems!\n", escape.pixel_format); - SetLastError(ERROR_INVALID_PIXEL_FORMAT); - return NULL; + if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl ) || + !XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&gl )) + { + if (!(ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret)))) goto done; + ret->hdc = hdc; + ret->fmt = gl->format; + ret->vis = pglXGetVisualFromFBConfig(gdi_display, gl->format->fbconfig); + ret->ctx = create_glxcontext(gdi_display, ret, NULL); + list_add_head( &context_list, &ret->entry ); } + else SetLastError( ERROR_INVALID_PIXEL_FORMAT ); - if (!(ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret)))) return 0; - - ret->hdc = hdc; - ret->fmt = fmt; - ret->has_been_current = FALSE; - ret->sharing = FALSE; - - ret->vis = pglXGetVisualFromFBConfig(gdi_display, fmt->fbconfig); - ret->ctx = create_glxcontext(gdi_display, ret, NULL); - - EnterCriticalSection( &context_section ); - list_add_head( &context_list, &ret->entry ); +done: LeaveCriticalSection( &context_section ); - - TRACE(" creating context %p (GL context creation delayed)\n", ret); + TRACE( "%p -> %p\n", hdc, ret ); return ret; }
1
0
0
0
Alexandre Julliard : winex11: Store a format pointer instead of an index in the drawable structures.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 356f9897cd890b29b5a373e06bc075c0b86a15ed URL:
http://source.winehq.org/git/wine.git/?a=commit;h=356f9897cd890b29b5a373e06…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Sep 7 15:36:57 2012 +0200 winex11: Store a format pointer instead of an index in the drawable structures. --- dlls/winex11.drv/opengl.c | 46 ++++++++++++++++++++++---------------------- 1 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index a31c5ef..3c557db 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -184,23 +184,23 @@ enum dc_gl_type struct glx_physdev { - struct gdi_physdev dev; - X11DRV_PDEVICE *x11dev; - enum dc_gl_type type; /* type of GL device context */ - int pixel_format; - Drawable drawable; - Pixmap pixmap; /* pixmap for a DL_GL_PIXMAP_WIN drawable */ + struct gdi_physdev dev; + X11DRV_PDEVICE *x11dev; + enum dc_gl_type type; /* type of GL device context */ + const struct wgl_pixel_format *format; + Drawable drawable; + Pixmap pixmap; /* pixmap for a DL_GL_PIXMAP_WIN drawable */ }; struct gl_drawable { - enum dc_gl_type type; /* type of GL surface */ - Drawable drawable; /* drawable for rendering to the client area */ - Pixmap pixmap; /* base pixmap if drawable is a GLXPixmap */ - Colormap colormap; /* colormap used for the drawable */ - int pixel_format; /* pixel format for the drawable */ - XVisualInfo *visual; /* information about the GL visual */ - RECT rect; /* drawable rect, relative to whole window drawable */ + enum dc_gl_type type; /* type of GL surface */ + Drawable drawable; /* drawable for rendering to the client area */ + Pixmap pixmap; /* base pixmap if drawable is a GLXPixmap */ + Colormap colormap; /* colormap used for the drawable */ + const struct wgl_pixel_format *format; /* pixel format for the drawable */ + XVisualInfo *visual; /* information about the GL visual */ + RECT rect; /* drawable rect, relative to whole window drawable */ }; /* X context to associate a struct gl_drawable to an hwnd */ @@ -1180,8 +1180,8 @@ BOOL set_win_format( HWND hwnd, XID fbconfig_id ) if (!(format = pixelformat_from_fbconfig_id( fbconfig_id ))) return FALSE; gl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*gl) ); - gl->pixel_format = format; - gl->visual = pglXGetVisualFromFBConfig( gdi_display, pixel_formats[format - 1].fbconfig ); + gl->format = &pixel_formats[format - 1]; + gl->visual = pglXGetVisualFromFBConfig( gdi_display, gl->format->fbconfig ); if (!gl->visual) { HeapFree( GetProcessHeap(), 0, gl ); @@ -1516,7 +1516,7 @@ static int glxdrv_wglGetPixelFormat( HDC hdc ) EnterCriticalSection( &context_section ); if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl ) || !XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&gl )) - ret = gl->pixel_format; + ret = gl->format - pixel_formats + 1; LeaveCriticalSection( &context_section ); /* Offscreen formats can't be used with traditional WGL calls. @@ -1561,7 +1561,7 @@ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORM EnterCriticalSection( &context_section ); if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl )) - prev = gl->pixel_format; + prev = gl->format - pixel_formats + 1; LeaveCriticalSection( &context_section ); if (prev) return prev == iPixelFormat; /* cannot change it if already set */ @@ -2212,7 +2212,7 @@ static HDC X11DRV_wglGetPbufferDCARB( struct wgl_pbuffer *object ) } gl->type = DC_GL_PBUFFER; gl->drawable = object->drawable; - gl->pixel_format = object->fmt - pixel_formats + 1; + gl->format = object->fmt; EnterCriticalSection( &context_section ); if (!XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&prev )) @@ -3206,28 +3206,28 @@ static INT glxdrv_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d if (!XFindContext( gdi_display, (XID)data->hwnd, gl_hwnd_context, (char **)&gl ) || !XFindContext( gdi_display, (XID)dev->hdc, gl_pbuffer_context, (char **)&gl )) { - physdev->pixel_format = gl->pixel_format; + physdev->format = gl->format; physdev->type = gl->type; physdev->drawable = gl->drawable; physdev->pixmap = gl->pixmap; } else { - physdev->pixel_format = 0; + physdev->format = NULL; physdev->type = DC_GL_NONE; physdev->drawable = 0; physdev->pixmap = 0; } LeaveCriticalSection( &context_section ); - TRACE( "SET_DRAWABLE hdc %p drawable %lx pf %u type %u\n", - dev->hdc, physdev->drawable, physdev->pixel_format, physdev->type ); + TRACE( "SET_DRAWABLE hdc %p drawable %lx pf %p type %u\n", + dev->hdc, physdev->drawable, physdev->format, physdev->type ); } break; case X11DRV_GET_DRAWABLE: if (out_count >= sizeof(struct x11drv_escape_get_drawable)) { struct x11drv_escape_get_drawable *data = out_data; - data->pixel_format = physdev->pixel_format; + data->pixel_format = physdev->format ? physdev->format - pixel_formats + 1 : 0; data->gl_drawable = physdev->drawable; } break;
1
0
0
0
Alexandre Julliard : winex11: Get the current pixel format from the drawable structure in wglGetPixelFormat .
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: bf5e1b6a05e631846b9ba7fff2edc36213884bf2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bf5e1b6a05e631846b9ba7fff…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Sep 7 15:31:05 2012 +0200 winex11: Get the current pixel format from the drawable structure in wglGetPixelFormat. --- dlls/winex11.drv/opengl.c | 30 +++++++++++++----------------- 1 files changed, 13 insertions(+), 17 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index d5d3ca9..a31c5ef 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1509,26 +1509,22 @@ static int glxdrv_wglDescribePixelFormat( HDC hdc, int iPixelFormat, */ static int glxdrv_wglGetPixelFormat( HDC hdc ) { - struct x11drv_escape_get_drawable escape; - - TRACE( "(%p)\n", hdc ); + HWND hwnd = WindowFromDC( hdc ); + struct gl_drawable *gl; + int ret = 0; - escape.code = X11DRV_GET_DRAWABLE; - if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape.code), (LPCSTR)&escape.code, - sizeof(escape), (LPSTR)&escape )) - return 0; + EnterCriticalSection( &context_section ); + if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl ) || + !XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&gl )) + ret = gl->pixel_format; + LeaveCriticalSection( &context_section ); - if (!is_valid_pixel_format( escape.pixel_format )) return 0; /* not set yet */ + /* Offscreen formats can't be used with traditional WGL calls. + * As has been verified on Windows GetPixelFormat doesn't fail but returns iPixelFormat=1. */ + if (ret && !is_onscreen_pixel_format( ret )) ret = 1; - if (!is_onscreen_pixel_format( escape.pixel_format )) - { - /* Offscreen formats can't be used with traditional WGL calls. - * As has been verified on Windows GetPixelFormat doesn't fail but returns iPixelFormat=1. */ - TRACE("Returning iPixelFormat=1 for offscreen format: %d\n", escape.pixel_format); - return 1; - } - TRACE("(%p): returns %d\n", hdc, escape.pixel_format); - return escape.pixel_format; + TRACE( "%p -> %d\n", hdc, ret ); + return ret; } /***********************************************************************
1
0
0
0
Alexandre Julliard : winex11: Store a drawable structure also for pbuffer contexts.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 4df8f15ff9cefccf030fa5b92c4c53b0267fa29e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4df8f15ff9cefccf030fa5b92…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Sep 7 15:23:15 2012 +0200 winex11: Store a drawable structure also for pbuffer contexts. --- dlls/winex11.drv/opengl.c | 81 ++++++++++++++++++++++++++++---------------- 1 files changed, 51 insertions(+), 30 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 00642ce..d5d3ca9 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -204,7 +204,9 @@ struct gl_drawable }; /* X context to associate a struct gl_drawable to an hwnd */ -static XContext gl_drawable_context; +static XContext gl_hwnd_context; +/* X context to associate a struct gl_drawable to a pbuffer hdc */ +static XContext gl_pbuffer_context; static const struct gdi_dc_funcs glxdrv_funcs; @@ -592,7 +594,8 @@ static BOOL has_opengl(void) ERR( "GLX extension is missing, disabling OpenGL.\n" ); goto failed; } - gl_drawable_context = XUniqueContext(); + gl_hwnd_context = XUniqueContext(); + gl_pbuffer_context = XUniqueContext(); /* In case of GLX you have direct and indirect rendering. Most of the time direct rendering is used * as in general only that is hardware accelerated. In some cases like in case of remote X indirect @@ -1160,7 +1163,7 @@ static void free_gl_drawable( struct gl_drawable *gl ) default: break; } - XFree( gl->visual ); + if (gl->visual) XFree( gl->visual ); HeapFree( GetProcessHeap(), 0, gl ); } @@ -1275,9 +1278,9 @@ BOOL set_win_format( HWND hwnd, XID fbconfig_id ) XFlush( gdi_display ); EnterCriticalSection( &context_section ); - if (!XFindContext( gdi_display, (XID)hwnd, gl_drawable_context, (char **)&prev )) + if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&prev )) free_gl_drawable( prev ); - XSaveContext( gdi_display, (XID)hwnd, gl_drawable_context, (char *)gl ); + XSaveContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char *)gl ); LeaveCriticalSection( &context_section ); /* force DCE invalidation */ @@ -1305,7 +1308,7 @@ void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_r EnterCriticalSection( &context_section ); - if (XFindContext( gdi_display, (XID)hwnd, gl_drawable_context, (char **)&gl )) goto done; + if (XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl )) goto done; if (changes.width != gl->rect.right - gl->rect.left) mask |= CWWidth; if (changes.height != gl->rect.bottom - gl->rect.top) mask |= CWHeight; @@ -1358,9 +1361,9 @@ void destroy_gl_drawable( HWND hwnd ) struct gl_drawable *gl; EnterCriticalSection( &context_section ); - if (!XFindContext( gdi_display, (XID)hwnd, gl_drawable_context, (char **)&gl )) + if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl )) { - XDeleteContext( gdi_display, (XID)hwnd, gl_drawable_context ); + XDeleteContext( gdi_display, (XID)hwnd, gl_hwnd_context ); free_gl_drawable( gl ); } LeaveCriticalSection( &context_section ); @@ -1561,7 +1564,7 @@ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORM } EnterCriticalSection( &context_section ); - if (!XFindContext( gdi_display, (XID)hwnd, gl_drawable_context, (char **)&gl )) + if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl )) prev = gl->pixel_format; LeaveCriticalSection( &context_section ); @@ -2200,11 +2203,27 @@ static BOOL X11DRV_wglDestroyPbufferARB( struct wgl_pbuffer *object ) static HDC X11DRV_wglGetPbufferDCARB( struct wgl_pbuffer *object ) { struct x11drv_escape_set_drawable escape; + struct gl_drawable *gl, *prev; HDC hdc; hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL ); if (!hdc) return 0; + if (!(gl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*gl) ))) + { + DeleteDC( hdc ); + return 0; + } + gl->type = DC_GL_PBUFFER; + gl->drawable = object->drawable; + gl->pixel_format = object->fmt - pixel_formats + 1; + + EnterCriticalSection( &context_section ); + if (!XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&prev )) + free_gl_drawable( prev ); + XSaveContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char *)gl ); + LeaveCriticalSection( &context_section ); + escape.code = X11DRV_SET_DRAWABLE; escape.hwnd = 0; escape.drawable = object->drawable; @@ -2313,7 +2332,18 @@ static BOOL X11DRV_wglQueryPbufferARB( struct wgl_pbuffer *object, int iAttribut */ static int X11DRV_wglReleasePbufferDCARB( struct wgl_pbuffer *object, HDC hdc ) { + struct gl_drawable *gl; + TRACE("(%p, %p)\n", object, hdc); + + EnterCriticalSection( &context_section ); + if (!XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&gl )) + { + XDeleteContext( gdi_display, (XID)hdc, gl_pbuffer_context ); + free_gl_drawable( gl ); + } + LeaveCriticalSection( &context_section ); + return DeleteDC(hdc); } @@ -3176,32 +3206,23 @@ static INT glxdrv_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d struct gl_drawable *gl; const struct x11drv_escape_set_drawable *data = in_data; - if (!data->hwnd) /* pbuffer */ + EnterCriticalSection( &context_section ); + if (!XFindContext( gdi_display, (XID)data->hwnd, gl_hwnd_context, (char **)&gl ) || + !XFindContext( gdi_display, (XID)dev->hdc, gl_pbuffer_context, (char **)&gl )) { - physdev->pixel_format = pixelformat_from_fbconfig_id( data->fbconfig_id ); - physdev->type = DC_GL_PBUFFER; - physdev->drawable = data->drawable; - physdev->pixmap = 0; + physdev->pixel_format = gl->pixel_format; + physdev->type = gl->type; + physdev->drawable = gl->drawable; + physdev->pixmap = gl->pixmap; } else { - EnterCriticalSection( &context_section ); - if (!XFindContext( gdi_display, (XID)data->hwnd, gl_drawable_context, (char **)&gl )) - { - physdev->pixel_format = gl->pixel_format; - physdev->type = gl->type; - physdev->drawable = gl->drawable; - physdev->pixmap = gl->pixmap; - } - else - { - physdev->pixel_format = 0; - physdev->type = DC_GL_NONE; - physdev->drawable = 0; - physdev->pixmap = 0; - } - LeaveCriticalSection( &context_section ); + physdev->pixel_format = 0; + physdev->type = DC_GL_NONE; + physdev->drawable = 0; + physdev->pixmap = 0; } + LeaveCriticalSection( &context_section ); TRACE( "SET_DRAWABLE hdc %p drawable %lx pf %u type %u\n", dev->hdc, physdev->drawable, physdev->pixel_format, physdev->type ); }
1
0
0
0
Alexandre Julliard : winex11: Get the current pixel format from the drawable structure for wglSetPixelFormat .
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: ecc8559fe800df985b37afd6b1f2347c246e4039 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ecc8559fe800df985b37afd6b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Sep 7 15:06:19 2012 +0200 winex11: Get the current pixel format from the drawable structure for wglSetPixelFormat. --- dlls/winex11.drv/opengl.c | 46 +++++++++++++++++++------------------------- 1 files changed, 20 insertions(+), 26 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 84651c0..00642ce 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1533,25 +1533,16 @@ static int glxdrv_wglGetPixelFormat( HDC hdc ) */ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd ) { - struct x11drv_escape_get_drawable escape; const struct wgl_pixel_format *fmt; - int value; - HWND hwnd; + int value, prev = 0; + struct gl_drawable *gl; + HWND hwnd = WindowFromDC( hdc ); TRACE("(%p,%d,%p)\n", hdc, iPixelFormat, ppfd); - escape.code = X11DRV_GET_DRAWABLE; - if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape.code), (LPCSTR)&escape.code, - sizeof(escape), (LPSTR)&escape )) - return 0; - - if (escape.pixel_format) /* cannot change it if already set */ - return (escape.pixel_format == iPixelFormat); - - /* SetPixelFormat is not allowed on the X root_window e.g. GetDC(0) */ - if (escape.drawable == root_window) + if (!hwnd || hwnd == GetDesktopWindow()) { - ERR("Invalid operation on root_window\n"); + WARN( "not a proper window DC %p/%p\n", hdc, hwnd ); return FALSE; } @@ -1563,21 +1554,24 @@ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORM } pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value); + if (!(value & GLX_WINDOW_BIT)) + { + WARN("Pixel format %d is not compatible for window rendering\n", iPixelFormat); + return FALSE; + } - hwnd = WindowFromDC( hdc ); - if(hwnd) { - if(!(value&GLX_WINDOW_BIT)) { - WARN("Pixel format %d is not compatible for window rendering\n", iPixelFormat); - return FALSE; - } + EnterCriticalSection( &context_section ); + if (!XFindContext( gdi_display, (XID)hwnd, gl_drawable_context, (char **)&gl )) + prev = gl->pixel_format; + LeaveCriticalSection( &context_section ); - if(!SendMessageW(hwnd, WM_X11DRV_SET_WIN_FORMAT, fmt->fmt_id, 0)) { - ERR("Couldn't set format of the window, returning failure\n"); - return FALSE; - } - /* physDev->current_pf will be set by the DCE update */ + if (prev) return prev == iPixelFormat; /* cannot change it if already set */ + + if(!SendMessageW(hwnd, WM_X11DRV_SET_WIN_FORMAT, fmt->fmt_id, 0)) { + ERR("Couldn't set format of the window, returning failure\n"); + return FALSE; } - else FIXME("called on a non-window object?\n"); + /* physDev->current_pf will be set by the DCE update */ if (TRACE_ON(wgl)) { int gl_test = 0;
1
0
0
0
Qian Hong : gdi32: Fixed family and face name on non English locale.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 245308597ffbe1243169211ced5e6ffbcc55c1d5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=245308597ffbe1243169211ce…
Author: Qian Hong <fracting(a)gmail.com> Date: Fri Sep 7 18:41:02 2012 +0800 gdi32: Fixed family and face name on non English locale. --- dlls/gdi32/freetype.c | 10 +++++++--- dlls/gdi32/tests/font.c | 31 +++++++++++++++++-------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index feca48a..20d6f9e 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -1552,7 +1552,7 @@ static void get_family_names( FT_Face ft_face, WCHAR **name, WCHAR **english, BO *english = get_face_name( ft_face, TT_NAME_ID_FONT_FAMILY, TT_MS_LANGID_ENGLISH_UNITED_STATES ); if (!*english) *english = towstr( CP_ACP, ft_face->family_name ); - *name = get_face_name( ft_face, TT_NAME_ID_FONT_FAMILY, GetUserDefaultLCID() ); + *name = get_face_name( ft_face, TT_NAME_ID_FONT_FAMILY, GetSystemDefaultLCID() ); if (!*name) { *name = *english; @@ -1715,7 +1715,9 @@ static Face *create_face( FT_Face ft_face, FT_Long face_index, const char *file, My_FT_Bitmap_Size *size = (My_FT_Bitmap_Size *)ft_face->available_sizes; face->StyleName = towstr( CP_ACP, ft_face->style_name ); - face->FullName = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, TT_MS_LANGID_ENGLISH_UNITED_STATES ); + face->FullName = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, GetSystemDefaultLangID() ); + if (!face->FullName) + face->FullName = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, TT_MS_LANGID_ENGLISH_UNITED_STATES ); if (file) { face->file = strdupA( file ); @@ -6553,7 +6555,9 @@ static BOOL get_outline_text_metrics(GdiFont *font) MultiByteToWideChar(CP_ACP, 0, ft_face->style_name, -1, style_nameW, lensty/sizeof(WCHAR)); - face_nameW = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, TT_MS_LANGID_ENGLISH_UNITED_STATES ); + face_nameW = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, GetSystemDefaultLangID() ); + if (!face_nameW) + face_nameW = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, TT_MS_LANGID_ENGLISH_UNITED_STATES ); if (!face_nameW) { FIXME("failed to read face_nameW for font %s!\n", wine_dbgstr_w(font->name)); diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 10e015e..26d88ae 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -2784,7 +2784,7 @@ end: #define TT_NAME_ID_UNIQUE_ID 3 #define TT_NAME_ID_FULL_NAME 4 -static BOOL get_ttf_nametable_entry(HDC hdc, WORD name_id, WCHAR *out_buf, SIZE_T out_size) +static BOOL get_ttf_nametable_entry(HDC hdc, WORD name_id, WCHAR *out_buf, SIZE_T out_size, LCID language_id) { struct sfnt_name_header { @@ -2841,7 +2841,7 @@ static BOOL get_ttf_nametable_entry(HDC hdc, WORD name_id, WCHAR *out_buf, SIZE_ { if (GET_BE_WORD(entry[i].platform_id) != TT_PLATFORM_MICROSOFT || GET_BE_WORD(entry[i].encoding_id) != TT_MS_ID_UNICODE_CS || - GET_BE_WORD(entry[i].language_id) != TT_MS_LANGID_ENGLISH_UNITED_STATES || + GET_BE_WORD(entry[i].language_id) != language_id || GET_BE_WORD(entry[i].name_id) != name_id) { continue; @@ -4035,7 +4035,7 @@ static void test_fullname(void) of = SelectObject(hdc, hfont); bufW[0] = 0; bufA[0] = 0; - ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FULL_NAME, bufW, sizeof(bufW)); + ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FULL_NAME, bufW, sizeof(bufW), TT_MS_LANGID_ENGLISH_UNITED_STATES); ok(ret, "face full name could not be read\n"); WideCharToMultiByte(CP_ACP, 0, bufW, -1, bufA, sizeof(bufW), NULL, FALSE); ok(!lstrcmpA(bufA, TestName[i]), "font full names don't match: %s != %s\n", TestName[i], bufA); @@ -4057,13 +4057,6 @@ static void test_fullname2_helper(const char *Family) int i; DWORD otm_size, ret, buf_size; OUTLINETEXTMETRICA *otm; - LCID lcid = GetSystemDefaultLangID(); - - if (lcid != TT_MS_LANGID_ENGLISH_UNITED_STATES) - { - skip("Skip test: LCID = %d\n", lcid); - return; - } hdc = CreateCompatibleDC(0); ok(hdc != NULL, "CreateCompatibleDC failed\n"); @@ -4111,7 +4104,12 @@ static void test_fullname2_helper(const char *Family) bufW[0] = 0; bufA[0] = 0; - ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FONT_FAMILY, bufW, buf_size); + ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FONT_FAMILY, bufW, buf_size, GetSystemDefaultLangID()); + if (!ret) + { + trace("no localized name found.\n"); + ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FONT_FAMILY, bufW, buf_size, TT_MS_LANGID_ENGLISH_UNITED_STATES); + } ok(ret, "FAMILY (family name) could not be read\n"); WideCharToMultiByte(CP_ACP, 0, bufW, -1, bufA, buf_size, NULL, FALSE); ok(!lstrcmpA(FamilyName, bufA), "font family names don't match: returned %s, expect %s\n", FamilyName, bufA); @@ -4120,7 +4118,12 @@ static void test_fullname2_helper(const char *Family) bufW[0] = 0; bufA[0] = 0; - ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FULL_NAME, bufW, buf_size); + ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FULL_NAME, bufW, buf_size, GetSystemDefaultLangID()); + if (!ret) + { + trace("no localized name found.\n"); + ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FULL_NAME, bufW, buf_size, TT_MS_LANGID_ENGLISH_UNITED_STATES); + } ok(ret, "FULL_NAME (face name) could not be read\n"); WideCharToMultiByte(CP_ACP, 0, bufW, -1, bufA, buf_size, NULL, FALSE); ok(!lstrcmpA(FaceName, bufA), "font face names don't match: returned %s, expect %s\n", FaceName, bufA); @@ -4129,7 +4132,7 @@ static void test_fullname2_helper(const char *Family) bufW[0] = 0; bufA[0] = 0; - ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FONT_SUBFAMILY, bufW, buf_size); + ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FONT_SUBFAMILY, bufW, buf_size, TT_MS_LANGID_ENGLISH_UNITED_STATES); ok(ret, "SUBFAMILY (style name) could not be read\n"); WideCharToMultiByte(CP_ACP, 0, bufW, -1, bufA, buf_size, NULL, FALSE); ok(!lstrcmpA(StyleName, bufA), "style names don't match: returned %s, expect %s\n", FaceName, bufA); @@ -4138,7 +4141,7 @@ static void test_fullname2_helper(const char *Family) bufW[0] = 0; bufA[0] = 0; - ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_UNIQUE_ID, bufW, buf_size); + ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_UNIQUE_ID, bufW, buf_size, TT_MS_LANGID_ENGLISH_UNITED_STATES); ok(ret, "UNIQUE_ID (full name) could not be read\n"); WideCharToMultiByte(CP_ACP, 0, bufW, -1, bufA, buf_size, NULL, FALSE); otmStr = (LPSTR)otm + (UINT_PTR)otm->otmpFullName;
1
0
0
0
Qian Hong : gdi32: Read otmpFullName from TT_NAME_ID_UNIQUE_ID.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 733aca30f4976a858d4e7a36628922f1eb898197 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=733aca30f4976a858d4e7a366…
Author: Qian Hong <fracting(a)gmail.com> Date: Fri Sep 7 18:40:34 2012 +0800 gdi32: Read otmpFullName from TT_NAME_ID_UNIQUE_ID. --- dlls/gdi32/freetype.c | 24 +++++++++++++++++------- dlls/gdi32/tests/font.c | 2 +- dlls/wineps.drv/download.c | 4 ++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 9d3d4c4..feca48a 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -6528,13 +6528,12 @@ static BOOL get_outline_text_metrics(GdiFont *font) { BOOL ret = FALSE; FT_Face ft_face = font->ft_face; - UINT needed, lenfam, lensty, lenface; + UINT needed, lenfam, lensty, lenface, lenfull; TT_OS2 *pOS2; TT_HoriHeader *pHori; TT_Postscript *pPost; FT_Fixed x_scale, y_scale; - WCHAR *family_nameW, *style_nameW, *face_nameW; - static const WCHAR spaceW[] = {' ', '\0'}; + WCHAR *family_nameW, *style_nameW, *face_nameW, *full_nameW; char *cp; INT ascent, descent; @@ -6556,9 +6555,21 @@ static BOOL get_outline_text_metrics(GdiFont *font) face_nameW = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, TT_MS_LANGID_ENGLISH_UNITED_STATES ); if (!face_nameW) + { + FIXME("failed to read face_nameW for font %s!\n", wine_dbgstr_w(font->name)); face_nameW = strdupW(font->name); + } lenface = (strlenW(face_nameW) + 1) * sizeof(WCHAR); + full_nameW = get_face_name( ft_face, TT_NAME_ID_UNIQUE_ID, TT_MS_LANGID_ENGLISH_UNITED_STATES ); + if (!full_nameW) + { + WCHAR fake_nameW[] = {'f','a','k','e',' ','n','a','m','e', 0}; + FIXME("failed to read full_nameW for font %s!\n", wine_dbgstr_w(font->name)); + full_nameW = strdupW(fake_nameW); + } + lenfull = (strlenW(full_nameW) + 1) * sizeof(WCHAR); + /* These names should be read from the TT name table */ /* length of otmpFamilyName */ @@ -6571,7 +6582,7 @@ static BOOL get_outline_text_metrics(GdiFont *font) needed += lensty; /* length of otmpFullName */ - needed += lenfam + lensty; + needed += lenfull; x_scale = ft_face->size->metrics.x_scale; @@ -6817,15 +6828,14 @@ static BOOL get_outline_text_metrics(GdiFont *font) strcpyW((WCHAR*)cp, face_nameW); cp += lenface; font->potm->otmpFullName = (LPSTR)(cp - (char*)font->potm); - strcpyW((WCHAR*)cp, family_nameW); - strcatW((WCHAR*)cp, spaceW); - strcatW((WCHAR*)cp, style_nameW); + strcpyW((WCHAR*)cp, full_nameW); ret = TRUE; end: HeapFree(GetProcessHeap(), 0, style_nameW); HeapFree(GetProcessHeap(), 0, family_nameW); HeapFree(GetProcessHeap(), 0, face_nameW); + HeapFree(GetProcessHeap(), 0, full_nameW); return ret; } diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 4a1532a..10e015e 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -4142,7 +4142,7 @@ static void test_fullname2_helper(const char *Family) ok(ret, "UNIQUE_ID (full name) could not be read\n"); WideCharToMultiByte(CP_ACP, 0, bufW, -1, bufA, buf_size, NULL, FALSE); otmStr = (LPSTR)otm + (UINT_PTR)otm->otmpFullName; - todo_wine ok(!lstrcmpA(otmStr, bufA), "UNIQUE ID (full name) doesn't match: returned %s, expect %s\n", otmStr, bufA); + ok(!lstrcmpA(otmStr, bufA), "UNIQUE ID (full name) doesn't match: returned %s, expect %s\n", otmStr, bufA); SelectObject(hdc, of); DeleteObject(hfont); diff --git a/dlls/wineps.drv/download.c b/dlls/wineps.drv/download.c index 6b87172..fbd868c 100644 --- a/dlls/wineps.drv/download.c +++ b/dlls/wineps.drv/download.c @@ -118,9 +118,9 @@ static void get_download_name(PHYSDEV dev, LPOUTLINETEXTMETRICA potm, char **str } } - len = strlen((char*)potm + (ptrdiff_t)potm->otmpFullName) + 1; + len = strlen((char*)potm + (ptrdiff_t)potm->otmpFaceName) + 1; *str = HeapAlloc(GetProcessHeap(),0,len); - strcpy(*str, (char*)potm + (ptrdiff_t)potm->otmpFullName); + strcpy(*str, (char*)potm + (ptrdiff_t)potm->otmpFaceName); p = *str; while((p = strchr(p, ' ')))
1
0
0
0
Qian Hong : gdi32: Read otmpFaceName from TT_NAME_ID_FULL_NAME.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: abc8f2c6c270a8f6bce8c5c1f0fc5b5773dad4a9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=abc8f2c6c270a8f6bce8c5c1f…
Author: Qian Hong <fracting(a)gmail.com> Date: Fri Sep 7 18:40:12 2012 +0800 gdi32: Read otmpFaceName from TT_NAME_ID_FULL_NAME. --- dlls/gdi32/freetype.c | 89 ++++++++++++++++------------------------------ dlls/gdi32/tests/font.c | 5 +-- 2 files changed, 32 insertions(+), 62 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 8222a18..9d3d4c4 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -2624,13 +2624,12 @@ static void update_reg_entries(void) { HKEY winnt_key = 0, win9x_key = 0, external_key = 0; LPWSTR valueW; - DWORD len, len_fam; + DWORD len; Family *family; Face *face; struct list *family_elem_ptr, *face_elem_ptr; WCHAR *file; static const WCHAR TrueType[] = {' ','(','T','r','u','e','T','y','p','e',')','\0'}; - static const WCHAR spaceW[] = {' ', '\0'}; char *path; if(RegCreateKeyExW(HKEY_LOCAL_MACHINE, winnt_font_reg_key, @@ -2655,20 +2654,22 @@ static void update_reg_entries(void) LIST_FOR_EACH(family_elem_ptr, &font_list) { family = LIST_ENTRY(family_elem_ptr, Family, entry); - len_fam = strlenW(family->FamilyName) + sizeof(TrueType) / sizeof(WCHAR) + 1; LIST_FOR_EACH(face_elem_ptr, &family->faces) { face = LIST_ENTRY(face_elem_ptr, Face, entry); if(!face->external) continue; - len = len_fam; - if (!(face->ntmFlags & NTM_REGULAR)) - len = len_fam + strlenW(face->StyleName) + 1; - valueW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - strcpyW(valueW, family->FamilyName); - if(len != len_fam) { - strcatW(valueW, spaceW); - strcatW(valueW, face->StyleName); + + if(face->FullName) + { + len = strlenW(face->FullName) + sizeof(TrueType) / sizeof(WCHAR) + 1; + valueW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + strcpyW(valueW, face->FullName); + } + else + { + len = strlenW(family->FamilyName) + sizeof(TrueType) / sizeof(WCHAR) + 1; + valueW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + strcpyW(valueW, family->FamilyName); } - strcatW(valueW, TrueType); file = wine_get_dos_file_name(face->file); if(file) @@ -5078,7 +5079,7 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, (WCHAR*)((char*)font->potm + (ULONG_PTR)font->potm->otmpFamilyName), LF_FACESIZE); lstrcpynW(pelf->elfFullName, - (WCHAR*)((char*)font->potm + (ULONG_PTR)font->potm->otmpFullName), + (WCHAR*)((char*)font->potm + (ULONG_PTR)font->potm->otmpFaceName), LF_FULLFACESIZE); lstrcpynW(pelf->elfStyle, (WCHAR*)((char*)font->potm + (ULONG_PTR)font->potm->otmpStyleName), @@ -5138,15 +5139,6 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, free_font(font); } -static void create_full_name(WCHAR *full_name, const WCHAR *family_name, const WCHAR *style_name) -{ - static const WCHAR spaceW[] = { ' ', 0 }; - - strcpyW(full_name, family_name); - strcatW(full_name, spaceW); - strcatW(full_name, style_name); -} - static BOOL family_matches(Family *family, const LOGFONTW *lf) { const struct list *face_list, *face_elem_ptr; @@ -5156,18 +5148,9 @@ static BOOL family_matches(Family *family, const LOGFONTW *lf) face_list = get_face_list_from_family(family); LIST_FOR_EACH(face_elem_ptr, face_list) { - WCHAR full_family_name[LF_FULLFACESIZE]; Face *face = LIST_ENTRY(face_elem_ptr, Face, entry); - if (strlenW(family->FamilyName) + strlenW(face->StyleName) + 2 > LF_FULLFACESIZE) - { - FIXME("Length of %s + %s + 2 is longer than LF_FULLFACESIZE\n", - debugstr_w(family->FamilyName), debugstr_w(face->StyleName)); - continue; - } - - create_full_name(full_family_name, family->FamilyName, face->StyleName); - if (!strcmpiW(lf->lfFaceName, full_family_name)) return TRUE; + if (face->FullName && !strcmpiW(lf->lfFaceName, face->FullName)) return TRUE; } return FALSE; @@ -5175,19 +5158,9 @@ static BOOL family_matches(Family *family, const LOGFONTW *lf) static BOOL face_matches(const WCHAR *family_name, Face *face, const LOGFONTW *lf) { - WCHAR full_family_name[LF_FULLFACESIZE]; - if (!strcmpiW(lf->lfFaceName, family_name)) return TRUE; - if (strlenW(family_name) + strlenW(face->StyleName) + 2 > LF_FULLFACESIZE) - { - FIXME("Length of %s + %s + 2 is longer than LF_FULLFACESIZE\n", - debugstr_w(family_name), debugstr_w(face->StyleName)); - return FALSE; - } - - create_full_name(full_family_name, family_name, face->StyleName); - return !strcmpiW(lf->lfFaceName, full_family_name); + return (face->FullName && !strcmpiW(lf->lfFaceName, face->FullName)); } static BOOL enum_face_charsets(const Family *family, Face *face, struct enum_charset_list *list, @@ -5216,7 +5189,10 @@ static BOOL enum_face_charsets(const Family *family, Face *face, struct enum_cha if (family != face->family) { strcpyW(elf.elfLogFont.lfFaceName, family->FamilyName); - create_full_name(elf.elfFullName, family->FamilyName, face->StyleName); + if (face->FullName) + strcpyW(elf.elfFullName, face->FullName); + else + strcpyW(elf.elfFullName, family->FamilyName); } TRACE("enuming face %s full %s style %s charset = %d type %d script %s it %d weight %d ntmflags %08x\n", debugstr_w(elf.elfLogFont.lfFaceName), @@ -6552,12 +6528,12 @@ static BOOL get_outline_text_metrics(GdiFont *font) { BOOL ret = FALSE; FT_Face ft_face = font->ft_face; - UINT needed, lenfam, lensty; + UINT needed, lenfam, lensty, lenface; TT_OS2 *pOS2; TT_HoriHeader *pHori; TT_Postscript *pPost; FT_Fixed x_scale, y_scale; - WCHAR *family_nameW, *style_nameW; + WCHAR *family_nameW, *style_nameW, *face_nameW; static const WCHAR spaceW[] = {' ', '\0'}; char *cp; INT ascent, descent; @@ -6578,17 +6554,18 @@ static BOOL get_outline_text_metrics(GdiFont *font) MultiByteToWideChar(CP_ACP, 0, ft_face->style_name, -1, style_nameW, lensty/sizeof(WCHAR)); + face_nameW = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, TT_MS_LANGID_ENGLISH_UNITED_STATES ); + if (!face_nameW) + face_nameW = strdupW(font->name); + lenface = (strlenW(face_nameW) + 1) * sizeof(WCHAR); + /* These names should be read from the TT name table */ /* length of otmpFamilyName */ needed += lenfam; /* length of otmpFaceName */ - if ((ft_face->style_flags & (FT_STYLE_FLAG_ITALIC | FT_STYLE_FLAG_BOLD)) == 0) { - needed += lenfam; /* just the family name */ - } else { - needed += lenfam + lensty; /* family + " " + style */ - } + needed += lenface; /* length of otmpStyleName */ needed += lensty; @@ -6837,13 +6814,8 @@ static BOOL get_outline_text_metrics(GdiFont *font) strcpyW((WCHAR*)cp, style_nameW); cp += lensty; font->potm->otmpFaceName = (LPSTR)(cp - (char*)font->potm); - strcpyW((WCHAR*)cp, family_nameW); - if (ft_face->style_flags & (FT_STYLE_FLAG_ITALIC | FT_STYLE_FLAG_BOLD)) { - strcatW((WCHAR*)cp, spaceW); - strcatW((WCHAR*)cp, style_nameW); - cp += lenfam + lensty; - } else - cp += lenfam; + strcpyW((WCHAR*)cp, face_nameW); + cp += lenface; font->potm->otmpFullName = (LPSTR)(cp - (char*)font->potm); strcpyW((WCHAR*)cp, family_nameW); strcatW((WCHAR*)cp, spaceW); @@ -6853,6 +6825,7 @@ static BOOL get_outline_text_metrics(GdiFont *font) end: HeapFree(GetProcessHeap(), 0, style_nameW); HeapFree(GetProcessHeap(), 0, family_nameW); + HeapFree(GetProcessHeap(), 0, face_nameW); return ret; } diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index d5126a0..4a1532a 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -4125,10 +4125,7 @@ static void test_fullname2_helper(const char *Family) WideCharToMultiByte(CP_ACP, 0, bufW, -1, bufA, buf_size, NULL, FALSE); ok(!lstrcmpA(FaceName, bufA), "font face names don't match: returned %s, expect %s\n", FaceName, bufA); otmStr = (LPSTR)otm + (UINT_PTR)otm->otmpFaceName; - if(!lstrcmpA(FaceName, "Lucida Sans Regular")) - todo_wine ok(!lstrcmpA(FaceName, otmStr), "FaceName %s doesn't match otmpFaceName %s\n", FaceName, otmStr); - else - ok(!lstrcmpA(FaceName, otmStr), "FaceName %s doesn't match otmpFaceName %s\n", FaceName, otmStr); + ok(!lstrcmpA(FaceName, otmStr), "FaceName %s doesn't match otmpFaceName %s\n", FaceName, otmStr); bufW[0] = 0; bufA[0] = 0;
1
0
0
0
← Newer
1
...
64
65
66
67
68
69
70
...
83
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
Results per page:
10
25
50
100
200