From 95a67ab3733bb161433f9181c5d9c20586baff7d Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Tue, 3 Oct 2006 21:22:22 +0200 Subject: [PATCH] gdi32: Route WGL font code through gdi32.dll. --- dlls/gdi/driver.c | 2 ++ dlls/gdi/gdi32.spec | 2 ++ dlls/gdi/gdi_private.h | 2 ++ dlls/gdi/opengl.c | 38 +++++++++++++++++++++++++++++++++++++ dlls/opengl32/opengl32.spec | 4 ++-- dlls/opengl32/wgl.c | 28 --------------------------- dlls/winex11.drv/opengl.c | 27 ++++++++------------------ 7 files changed, 54 insertions(+), 49 deletions(-) diff --git a/dlls/gdi/driver.c b/dlls/gdi/driver.c index b0e3f24ddd2..16c48e513e4 100644 --- a/dlls/gdi/driver.c +++ b/dlls/gdi/driver.c @@ -198,6 +198,8 @@ static struct graphics_driver *create_driver( HMODULE module ) /* OpenGL32 */ GET_FUNC(wglCreateContext); GET_FUNC(wglMakeCurrent); + GET_FUNC(wglUseFontBitmapsA); + GET_FUNC(wglUseFontBitmapsW); #undef GET_FUNC } else memset( &driver->funcs, 0, sizeof(driver->funcs) ); diff --git a/dlls/gdi/gdi32.spec b/dlls/gdi/gdi32.spec index 73dd0c32a6c..b1883a7c025 100644 --- a/dlls/gdi/gdi32.spec +++ b/dlls/gdi/gdi32.spec @@ -500,6 +500,8 @@ # @ stdcall wglCreateContext(long) @ stdcall wglMakeCurrent(long long) +@ stdcall wglUseFontBitmapsA(long long long long) +@ stdcall wglUseFontBitmapsW(long long long long) ################################################################ # Wine extensions: Win16 functions that are needed by other dlls diff --git a/dlls/gdi/gdi_private.h b/dlls/gdi/gdi_private.h index e63308c4a50..02a13489279 100644 --- a/dlls/gdi/gdi_private.h +++ b/dlls/gdi/gdi_private.h @@ -186,6 +186,8 @@ typedef struct tagDC_FUNCS /* OpenGL32 */ HGLRC (*pwglCreateContext)(PHYSDEV); BOOL (*pwglMakeCurrent)(PHYSDEV, HGLRC); + BOOL (*pwglUseFontBitmapsA)(PHYSDEV, DWORD, DWORD, DWORD); + BOOL (*pwglUseFontBitmapsW)(PHYSDEV, DWORD, DWORD, DWORD); } DC_FUNCTIONS; /* It should not be necessary to access the contents of the GdiPath diff --git a/dlls/gdi/opengl.c b/dlls/gdi/opengl.c index b6012501953..25ca345ae09 100644 --- a/dlls/gdi/opengl.c +++ b/dlls/gdi/opengl.c @@ -74,3 +74,41 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) GDI_ReleaseObj( hdc); return ret; } + +/*********************************************************************** + * wglUseFontBitmapsA (OPENGL32.@) + */ +BOOL WINAPI wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase) +{ + BOOL ret = FALSE; + DC * dc = DC_GetDCPtr( hdc ); + + TRACE("(%p, %ld, %ld, %ld)\n", hdc, first, count, listBase); + + if (!dc) return FALSE; + + if (!dc->funcs->pwglUseFontBitmapsA) FIXME(" :stub\n"); + else ret = dc->funcs->pwglUseFontBitmapsA(dc->physDev, first, count, listBase); + + GDI_ReleaseObj( hdc); + return ret; +} + +/*********************************************************************** + * wglUseFontBitmapsW (OPENGL32.@) + */ +BOOL WINAPI wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase) +{ + BOOL ret = FALSE; + DC * dc = DC_GetDCPtr( hdc ); + + TRACE("(%p, %ld, %ld, %ld)\n", hdc, first, count, listBase); + + if (!dc) return FALSE; + + if (!dc->funcs->pwglUseFontBitmapsW) FIXME(" :stub\n"); + else ret = dc->funcs->pwglUseFontBitmapsW(dc->physDev, first, count, listBase); + + GDI_ReleaseObj( hdc); + return ret; +} diff --git a/dlls/opengl32/opengl32.spec b/dlls/opengl32/opengl32.spec index dbd93b28d5e..7fb060c25f3 100644 --- a/dlls/opengl32/opengl32.spec +++ b/dlls/opengl32/opengl32.spec @@ -394,7 +394,7 @@ @ stdcall wglShareLists(long long) @ stdcall wglSwapBuffers(long) gdi32.SwapBuffers @ stdcall wglSwapLayerBuffers(long long) -@ stdcall wglUseFontBitmapsA(long long long long) -@ stdcall wglUseFontBitmapsW(long long long long) +@ stdcall wglUseFontBitmapsA(long long long long) gdi32.wglUseFontBitmapsA +@ stdcall wglUseFontBitmapsW(long long long long) gdi32.wglUseFontBitmapsW @ stdcall wglUseFontOutlinesA(long long long long long long long ptr) @ stdcall wglUseFontOutlinesW(long long long long long long long ptr) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index f593b0188e0..516e09603f2 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -52,8 +52,6 @@ typedef struct wine_wgl_s { HDC WINAPI (*p_wglGetCurrentDC)(void); PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc); BOOL WINAPI (*p_wglShareLists)(HGLRC hglrc1, HGLRC hglrc2); - BOOL WINAPI (*p_wglUseFontBitmapsA)(HDC hdc, DWORD first, DWORD count, DWORD listBase); - BOOL WINAPI (*p_wglUseFontBitmapsW)(HDC hdc, DWORD first, DWORD count, DWORD listBase); void WINAPI (*p_wglGetIntegerv)(GLenum pname, GLint* params); } wine_wgl_t; @@ -327,30 +325,6 @@ BOOL WINAPI wglSwapLayerBuffers(HDC hdc, return TRUE; } -/*********************************************************************** - * wglUseFontBitmapsA (OPENGL32.@) - */ -BOOL WINAPI wglUseFontBitmapsA(HDC hdc, - DWORD first, - DWORD count, - DWORD listBase) -{ - TRACE("(%p, %ld, %ld, %ld)\n", hdc, first, count, listBase); - return wine_wgl.p_wglUseFontBitmapsA(hdc, first, count, listBase); -} - -/*********************************************************************** - * wglUseFontBitmapsW (OPENGL32.@) - */ -BOOL WINAPI wglUseFontBitmapsW(HDC hdc, - DWORD first, - DWORD count, - DWORD listBase) -{ - TRACE("(%p, %ld, %ld, %ld)\n", hdc, first, count, listBase); - return wine_wgl.p_wglUseFontBitmapsW(hdc, first, count, listBase); -} - #ifdef HAVE_GL_GLU_H static void fixed_to_double(POINTFX fixed, UINT em_size, GLdouble vertex[3]) @@ -680,8 +654,6 @@ static BOOL process_attach(void) wine_wgl.p_wglGetCurrentDC = (void *)GetProcAddress(mod, "wglGetCurrentDC"); wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod, "wglGetProcAddress"); wine_wgl.p_wglShareLists = (void *)GetProcAddress(mod, "wglShareLists"); - wine_wgl.p_wglUseFontBitmapsA = (void*)GetProcAddress(mod, "wglUseFontBitmapsA"); - wine_wgl.p_wglUseFontBitmapsW = (void*)GetProcAddress(mod, "wglUseFontBitmapsW"); /* Interal WGL function */ wine_wgl.p_wglGetIntegerv = (void *)GetProcAddress(mod, "wglGetIntegerv"); diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 6a77a2743c3..24b30cb4ce0 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -516,17 +516,6 @@ inline static void set_drawable( HDC hdc, Drawable drawable ) ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL ); } -/* retrieve the X font to use on a given DC */ -inline static Font get_font( HDC hdc ) -{ - Font font; - enum x11drv_escape_codes escape = X11DRV_GET_FONT; - - if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, - sizeof(font), (LPSTR)&font )) font = 0; - return font; -} - /** for use of wglGetCurrentReadDCARB */ inline static HDC get_hdc_from_Drawable(GLXDrawable d) { @@ -1589,14 +1578,14 @@ static BOOL internal_wglUseFontBitmaps(HDC hdc, DWORD first, DWORD count, DWORD } /* OpenGL32 wglUseFontBitmapsA */ -BOOL WINAPI X11DRV_wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase) +BOOL X11DRV_wglUseFontBitmapsA(X11DRV_PDEVICE *physDev, DWORD first, DWORD count, DWORD listBase) { - Font fid = get_font( hdc ); + Font fid = physDev->font; - TRACE("(%p, %ld, %ld, %ld) using font %ld\n", hdc, first, count, listBase, fid); + TRACE("(%p, %ld, %ld, %ld) using font %ld\n", physDev->hdc, first, count, listBase, fid); if (fid == 0) { - return internal_wglUseFontBitmaps(hdc, first, count, listBase, GetGlyphOutlineA); + return internal_wglUseFontBitmaps(physDev->hdc, first, count, listBase, GetGlyphOutlineA); } wine_tsx11_lock(); @@ -1607,14 +1596,14 @@ BOOL WINAPI X11DRV_wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD l } /* OpenGL32 wglUseFontBitmapsW */ -BOOL WINAPI X11DRV_wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase) +BOOL X11DRV_wglUseFontBitmapsW(X11DRV_PDEVICE *physDev, DWORD first, DWORD count, DWORD listBase) { - Font fid = get_font( hdc ); + Font fid = physDev->font; - TRACE("(%p, %ld, %ld, %ld) using font %ld\n", hdc, first, count, listBase, fid); + TRACE("(%p, %ld, %ld, %ld) using font %ld\n", physDev->hdc, first, count, listBase, fid); if (fid == 0) { - return internal_wglUseFontBitmaps(hdc, first, count, listBase, GetGlyphOutlineW); + return internal_wglUseFontBitmaps(physDev->hdc, first, count, listBase, GetGlyphOutlineW); } WARN("Using the glX API for the WCHAR variant - some characters may come out incorrectly !\n");