From cbfcce1a3dd1de19cb7fade8455448ab24613e4e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 12 Sep 2011 11:50:42 +0200 Subject: [PATCH] winex11: Add a SelectFont entry point in the XRender driver. --- dlls/winex11.drv/x11drv.h | 1 - dlls/winex11.drv/xfont.c | 6 ------ dlls/winex11.drv/xrender.c | 42 ++++++++++++++++++-------------------- 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index e8cda914c7..e5010b415a 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -303,7 +303,6 @@ extern int client_side_antialias_with_render DECLSPEC_HIDDEN; extern int using_client_side_fonts DECLSPEC_HIDDEN; extern const struct gdi_dc_funcs *X11DRV_XRender_Init(void) DECLSPEC_HIDDEN; extern void X11DRV_XRender_Finalize(void) DECLSPEC_HIDDEN; -extern BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE*, HFONT) DECLSPEC_HIDDEN; extern void X11DRV_XRender_SetDeviceClipping(X11DRV_PDEVICE *physDev, const RGNDATA *data) DECLSPEC_HIDDEN; extern void X11DRV_XRender_CopyBrush(X11DRV_PDEVICE *physDev, X_PHYSBITMAP *physBitmap, int width, int height) DECLSPEC_HIDDEN; extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, diff --git a/dlls/winex11.drv/xfont.c b/dlls/winex11.drv/xfont.c index 1e6e47c7eb..35d23d6a5c 100644 --- a/dlls/winex11.drv/xfont.c +++ b/dlls/winex11.drv/xfont.c @@ -3238,12 +3238,6 @@ HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) TRACE("gdiFont = %p\n", gdiFont); - if(gdiFont && using_client_side_fonts) { - X11DRV_XRender_SelectFont(physDev, hfont); - physDev->has_gdi_font = TRUE; - return FALSE; - } - EnterCriticalSection( &crtsc_fonts_X11 ); if(fontList == NULL) X11DRV_FONT_InitX11Metrics(); diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index e2a98583f7..7c70c30156 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -1091,24 +1091,30 @@ void X11DRV_XRender_Finalize(void) LeaveCriticalSection(&xrender_cs); } - -/*********************************************************************** - * X11DRV_XRender_SelectFont +/********************************************************************** + * xrenderdrv_SelectFont */ -BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont) +static HFONT xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) { + struct xrender_physdev *physdev = get_xrender_dev( dev ); LFANDSIZE lfsz; - struct xrender_info *info; - GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf); + if (!GetObjectW( hfont, sizeof(lfsz.lf), &lfsz.lf )) return HGDI_ERROR; + + if (!gdiFont) + { + dev = GET_NEXT_PHYSDEV( dev, pSelectFont ); + return dev->funcs->pSelectFont( dev, hfont, gdiFont ); + } + TRACE("h=%d w=%d weight=%d it=%d charset=%d name=%s\n", lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight, lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName)); lfsz.lf.lfWidth = abs( lfsz.lf.lfWidth ); - lfsz.devsize.cx = X11DRV_XWStoDS( physDev, lfsz.lf.lfWidth ); - lfsz.devsize.cy = X11DRV_YWStoDS( physDev, lfsz.lf.lfHeight ); + lfsz.devsize.cx = X11DRV_XWStoDS( physdev->x11dev, lfsz.lf.lfWidth ); + lfsz.devsize.cy = X11DRV_YWStoDS( physdev->x11dev, lfsz.lf.lfHeight ); - GetTransform( physDev->dev.hdc, 0x204, &lfsz.xform ); + GetTransform( dev->hdc, 0x204, &lfsz.xform ); TRACE("font transform %f %f %f %f\n", lfsz.xform.eM11, lfsz.xform.eM12, lfsz.xform.eM21, lfsz.xform.eM22); @@ -1117,14 +1123,12 @@ BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont) lfsz_calc_hash(&lfsz); - info = get_xrender_info(physDev); - if (!info) return 0; - EnterCriticalSection(&xrender_cs); - if(info->cache_index != -1) - dec_ref_cache(info->cache_index); - info->cache_index = GetCacheEntry(physDev, &lfsz); + if (physdev->info.cache_index != -1) + dec_ref_cache( physdev->info.cache_index ); + physdev->info.cache_index = GetCacheEntry( physdev->x11dev, &lfsz ); LeaveCriticalSection(&xrender_cs); + physdev->x11dev->has_gdi_font = TRUE; return 0; } @@ -2608,7 +2612,7 @@ static const struct gdi_dc_funcs xrender_funcs = xrenderdrv_SelectBitmap, /* pSelectBitmap */ NULL, /* pSelectBrush */ NULL, /* pSelectClipPath */ - NULL, /* pSelectFont */ + xrenderdrv_SelectFont, /* pSelectFont */ NULL, /* pSelectPalette */ NULL, /* pSelectPen */ NULL, /* pSetArcDirection */ @@ -2662,12 +2666,6 @@ void X11DRV_XRender_Finalize(void) { } -BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont) -{ - assert(0); - return FALSE; -} - void X11DRV_XRender_SetDeviceClipping(X11DRV_PDEVICE *physDev, const RGNDATA *data) { assert(0); -- 2.33.8