From ebd24807fe2f16bdbb30a3bb14d9129b2f1d3e73 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 4 Mar 2004 04:05:04 +0000 Subject: [PATCH] Pass the gdiFont object to the SelectFont driver entry point so that we don't need to look into the DC structure for it. --- dlls/gdi/enhmfdrv/enhmetafiledrv.h | 2 +- dlls/gdi/enhmfdrv/objects.c | 2 +- dlls/gdi/gdi_private.h | 2 +- dlls/gdi/mfdrv/metafiledrv.h | 2 +- dlls/gdi/mfdrv/objects.c | 2 +- dlls/ttydrv/objects.c | 2 +- dlls/ttydrv/ttydrv.spec | 2 +- dlls/wineps/font.c | 5 ++--- dlls/wineps/wineps.spec | 2 +- dlls/x11drv/text.c | 3 +-- dlls/x11drv/x11drv.h | 1 + dlls/x11drv/x11drv.spec | 2 +- dlls/x11drv/xfont.c | 11 ++++++----- objects/font.c | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dlls/gdi/enhmfdrv/enhmetafiledrv.h b/dlls/gdi/enhmfdrv/enhmetafiledrv.h index 14a073dfb8c..d9c8bfc9942 100644 --- a/dlls/gdi/enhmfdrv/enhmetafiledrv.h +++ b/dlls/gdi/enhmfdrv/enhmetafiledrv.h @@ -120,7 +120,7 @@ extern INT EMFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, extern HBITMAP EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ); extern HBRUSH EMFDRV_SelectBrush( PHYSDEV dev, HBRUSH handle ); extern BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode ); -extern HFONT EMFDRV_SelectFont( PHYSDEV dev, HFONT handle ); +extern HFONT EMFDRV_SelectFont( PHYSDEV dev, HFONT handle, HANDLE gdiFont ); extern HPEN EMFDRV_SelectPen( PHYSDEV dev, HPEN handle ); extern INT EMFDRV_SetArcDirection( PHYSDEV dev, INT arcDirection ); extern COLORREF EMFDRV_SetBkColor( PHYSDEV dev, COLORREF color ); diff --git a/dlls/gdi/enhmfdrv/objects.c b/dlls/gdi/enhmfdrv/objects.c index 6bae1eaee83..85603769de3 100644 --- a/dlls/gdi/enhmfdrv/objects.c +++ b/dlls/gdi/enhmfdrv/objects.c @@ -257,7 +257,7 @@ static BOOL EMFDRV_CreateFontIndirect(PHYSDEV dev, HFONT hFont ) /*********************************************************************** * EMFDRV_SelectFont */ -HFONT EMFDRV_SelectFont( PHYSDEV dev, HFONT hFont ) +HFONT EMFDRV_SelectFont( PHYSDEV dev, HFONT hFont, HANDLE gdiFont ) { EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*)dev; EMRSELECTOBJECT emr; diff --git a/dlls/gdi/gdi_private.h b/dlls/gdi/gdi_private.h index b89d4f2e22e..c6d1956a514 100644 --- a/dlls/gdi/gdi_private.h +++ b/dlls/gdi/gdi_private.h @@ -126,7 +126,7 @@ typedef struct tagDC_FUNCS HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP); HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH); BOOL (*pSelectClipPath)(PHYSDEV,INT); - HFONT (*pSelectFont)(PHYSDEV,HFONT); + HFONT (*pSelectFont)(PHYSDEV,HFONT,HANDLE); HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL); HPEN (*pSelectPen)(PHYSDEV,HPEN); INT (*pSetArcDirection)(PHYSDEV,INT); diff --git a/dlls/gdi/mfdrv/metafiledrv.h b/dlls/gdi/mfdrv/metafiledrv.h index e8cf49e22dc..76b8591b844 100644 --- a/dlls/gdi/mfdrv/metafiledrv.h +++ b/dlls/gdi/mfdrv/metafiledrv.h @@ -123,7 +123,7 @@ extern INT MFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, extern HBITMAP MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ); extern HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH handle ); extern BOOL MFDRV_SelectClipPath( PHYSDEV dev, INT iMode ); -extern HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT handle ); +extern HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT handle, HANDLE gdiFont ); extern HPEN MFDRV_SelectPen( PHYSDEV dev, HPEN handle ); extern HPALETTE MFDRV_SelectPalette( PHYSDEV dev, HPALETTE hPalette, BOOL bForceBackground); extern UINT MFDRV_RealizePalette(PHYSDEV dev, HPALETTE hPalette, BOOL primary); diff --git a/dlls/gdi/mfdrv/objects.c b/dlls/gdi/mfdrv/objects.c index 0618a6bb7be..e7aaadd388b 100644 --- a/dlls/gdi/mfdrv/objects.c +++ b/dlls/gdi/mfdrv/objects.c @@ -271,7 +271,7 @@ static UINT16 MFDRV_CreateFontIndirect(PHYSDEV dev, HFONT hFont, LOGFONT16 *logf /*********************************************************************** * MFDRV_SelectFont */ -HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT hfont ) +HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) { METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev; LOGFONT16 lf16; diff --git a/dlls/ttydrv/objects.c b/dlls/ttydrv/objects.c index 00a06685597..d9d54dd2f05 100644 --- a/dlls/ttydrv/objects.c +++ b/dlls/ttydrv/objects.c @@ -28,7 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ttydrv); /*********************************************************************** * SelectFont (TTYDRV.@) */ -HFONT TTYDRV_SelectFont(TTYDRV_PDEVICE *physDev, HFONT hfont) +HFONT TTYDRV_SelectFont(TTYDRV_PDEVICE *physDev, HFONT hfont, HANDLE gdiFont) { TRACE("(%p, %p)\n", physDev->hdc, hfont); diff --git a/dlls/ttydrv/ttydrv.spec b/dlls/ttydrv/ttydrv.spec index 10ca443c937..bcd1bd7e563 100644 --- a/dlls/ttydrv/ttydrv.spec +++ b/dlls/ttydrv/ttydrv.spec @@ -26,7 +26,7 @@ @ cdecl Polyline(ptr ptr long) TTYDRV_DC_Polyline @ cdecl Rectangle(ptr long long long long) TTYDRV_DC_Rectangle @ cdecl RoundRect(ptr long long long long long long) TTYDRV_DC_RoundRect -@ cdecl SelectFont(ptr long) TTYDRV_SelectFont +@ cdecl SelectFont(ptr long long) TTYDRV_SelectFont @ cdecl SetBitmapBits(long ptr long) TTYDRV_SetBitmapBits @ cdecl SetDCOrg(ptr long long) TTYDRV_SetDCOrg @ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) TTYDRV_DC_SetDIBitsToDevice diff --git a/dlls/wineps/font.c b/dlls/wineps/font.c index 7be86c453aa..9b082b61625 100644 --- a/dlls/wineps/font.c +++ b/dlls/wineps/font.c @@ -27,7 +27,6 @@ #include "wingdi.h" #include "winspool.h" -#include "gdi.h" #include "psdrv.h" #include "wine/debug.h" @@ -36,7 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); /*********************************************************************** * SelectFont (WINEPS.@) */ -HFONT PSDRV_SelectFont( PSDRV_PDEVICE *physDev, HFONT hfont ) +HFONT PSDRV_SelectFont( PSDRV_PDEVICE *physDev, HFONT hfont, HANDLE gdiFont ) { LOGFONTW lf; BOOL subst = FALSE; @@ -111,7 +110,7 @@ HFONT PSDRV_SelectFont( PSDRV_PDEVICE *physDev, HFONT hfont ) physDev->font.escapement = lf.lfEscapement; physDev->font.set = FALSE; - if(physDev->dc->gdiFont && !subst) { + if(gdiFont && !subst) { if(PSDRV_SelectDownloadFont(physDev)) return 0; /* use gdi font */ } diff --git a/dlls/wineps/wineps.spec b/dlls/wineps/wineps.spec index d7ed42caeeb..178fbd5f1ab 100644 --- a/dlls/wineps/wineps.spec +++ b/dlls/wineps/wineps.spec @@ -29,7 +29,7 @@ @ cdecl RoundRect(ptr long long long long long long) PSDRV_RoundRect @ cdecl SelectBitmap(ptr long) PSDRV_SelectBitmap @ cdecl SelectBrush(ptr long) PSDRV_SelectBrush -@ cdecl SelectFont(ptr long) PSDRV_SelectFont +@ cdecl SelectFont(ptr long long) PSDRV_SelectFont @ cdecl SelectPen(ptr long) PSDRV_SelectPen @ cdecl SetBkColor(ptr long) PSDRV_SetBkColor @ cdecl SetDeviceClipping(ptr long long) PSDRV_SetDeviceClipping diff --git a/dlls/x11drv/text.c b/dlls/x11drv/text.c index 59adf3d5a60..8832a513f02 100644 --- a/dlls/x11drv/text.c +++ b/dlls/x11drv/text.c @@ -28,7 +28,6 @@ #include "winbase.h" #include "winnls.h" #include "wownt32.h" -#include "gdi.h" #include "x11font.h" #include "wine/debug.h" @@ -61,7 +60,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, UINT align = GetTextAlign( physDev->hdc ); INT charExtra = GetTextCharacterExtra( physDev->hdc ); - if(physDev->dc->gdiFont) + if(physDev->has_gdi_font) return X11DRV_XRender_ExtTextOut(physDev, x, y, flags, lprect, wstr, count, lpDx, breakExtra); if (!X11DRV_SetupGCForText( physDev )) return TRUE; diff --git a/dlls/x11drv/x11drv.h b/dlls/x11drv/x11drv.h index 9158a43635e..8c7973abe83 100644 --- a/dlls/x11drv/x11drv.h +++ b/dlls/x11drv/x11drv.h @@ -95,6 +95,7 @@ typedef struct X_PHYSFONT font; X_PHYSPEN pen; X_PHYSBRUSH brush; + BOOL has_gdi_font; /* is current font a GDI font? */ int backgroundPixel; int textPixel; int depth; /* bit depth of the DC */ diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec index a5ab235ac53..fc93d743858 100644 --- a/dlls/x11drv/x11drv.spec +++ b/dlls/x11drv/x11drv.spec @@ -42,7 +42,7 @@ @ cdecl RoundRect(ptr long long long long long long) X11DRV_RoundRect @ cdecl SelectBitmap(ptr long) X11DRV_SelectBitmap @ cdecl SelectBrush(ptr long) X11DRV_SelectBrush -@ cdecl SelectFont(ptr long) X11DRV_SelectFont +@ cdecl SelectFont(ptr long long) X11DRV_SelectFont @ cdecl SelectPen(ptr long) X11DRV_SelectPen @ cdecl SetBitmapBits(long ptr long) X11DRV_SetBitmapBits @ cdecl SetBkColor(ptr long) X11DRV_SetBkColor diff --git a/dlls/x11drv/xfont.c b/dlls/x11drv/xfont.c index c7e6102552c..2393d54b82d 100644 --- a/dlls/x11drv/xfont.c +++ b/dlls/x11drv/xfont.c @@ -42,7 +42,6 @@ #include "winnls.h" #include "winreg.h" #include "x11font.h" -#include "gdi.h" #include "wine/library.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -3255,7 +3254,7 @@ LPIFONTINFO16 XFONT_GetFontInfo( X_PHYSFONT pFont ) /*********************************************************************** * SelectFont (X11DRV.@) */ -HFONT X11DRV_SelectFont( X11DRV_PDEVICE *physDev, HFONT hfont ) +HFONT X11DRV_SelectFont( X11DRV_PDEVICE *physDev, HFONT hfont, HANDLE gdiFont ) { LOGFONTW logfont; LOGFONT16 lf; @@ -3264,10 +3263,11 @@ HFONT X11DRV_SelectFont( X11DRV_PDEVICE *physDev, HFONT hfont ) if (!GetObjectW( hfont, sizeof(logfont), &logfont )) return HGDI_ERROR; - TRACE("dc->gdiFont = %p\n", physDev->dc->gdiFont); + TRACE("gdiFont = %p\n", gdiFont); - if(physDev->dc->gdiFont && using_client_side_fonts) { + if(gdiFont && using_client_side_fonts) { X11DRV_XRender_SelectFont(physDev, hfont); + physDev->has_gdi_font = TRUE; return FALSE; } @@ -3338,6 +3338,7 @@ HFONT X11DRV_SelectFont( X11DRV_PDEVICE *physDev, HFONT hfont ) LeaveCriticalSection( &crtsc_fonts_X11 ); + physDev->has_gdi_font = FALSE; return (HFONT)1; /* Use a device font */ } @@ -3355,7 +3356,7 @@ BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf, BOOL b, bRet = 0; /* don't enumerate x11 fonts if we're using client side fonts */ - if (physDev->dc->gdiFont) return FALSE; + if (physDev->has_gdi_font) return FALSE; if( plf->lfFaceName[0] ) { diff --git a/objects/font.c b/objects/font.c index b407e58612a..cd029bc37f1 100644 --- a/objects/font.c +++ b/objects/font.c @@ -492,7 +492,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, void *obj, HDC hdc ) dc->gdiFont = WineEngCreateFontInstance(dc, handle); } - if (dc->funcs->pSelectFont) ret = dc->funcs->pSelectFont( dc->physDev, handle ); + if (dc->funcs->pSelectFont) ret = dc->funcs->pSelectFont( dc->physDev, handle, dc->gdiFont ); if (ret && dc->gdiFont) dc->gdiFont = 0;