Commit 6f7fc504 authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Uses Xrender extension to allow client side font rendering.

Adds nice things like anti-aliased text.
parent 74e4d21e
......@@ -15,6 +15,7 @@ C_SRCS = \
winpos.c \
x11ddraw.c \
x11drv_main.c \
xrender.c \
xvidmode.c
PROGRAMS = \
......
......@@ -9,7 +9,7 @@ import kernel32.dll
import ntdll.dll
debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
key keyboard opengl palette text win x11drv)
key keyboard opengl palette text win x11drv xrender)
# GDI driver
......
......@@ -99,6 +99,8 @@ void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, int org_x, int or
dc->DCOrgY = org_y;
physDev->drawable = drawable;
TSXSetSubwindowMode( gdi_display, physDev->gc, mode );
if(physDev->xrender)
X11DRV_XRender_UpdateDrawable(dc);
GDI_ReleaseObj( hdc );
}
}
......
......@@ -66,6 +66,9 @@ BOOL X11DRV_GDI_Initialize( Display *display )
if (!X11DRV_BITMAP_Init()) return FALSE;
/* Initialize XRender */
X11DRV_XRender_Init();
/* Initialize fonts and text caps */
log_pixels_x = MulDiv( WidthOfScreen(screen), 254, WidthMMOfScreen(screen) * 10 );
......@@ -157,6 +160,9 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
BOOL X11DRV_DeleteDC( DC *dc )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if(physDev->xrender)
X11DRV_XRender_DeleteDC(dc);
wine_tsx11_lock();
XFreeGC( gdi_display, physDev->gc );
while (physDev->used_visuals-- > 0)
......
......@@ -46,11 +46,17 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
BOOL dibUpdateFlag = FALSE;
BOOL result = TRUE;
if(dc->gdiFont)
return X11DRV_XRender_ExtTextOut(dc, x, y, flags, lprect, wstr, count,
lpDx);
if (!X11DRV_SetupGCForText( dc )) return TRUE;
pfo = XFONT_GetFontObject( physDev->font );
font = pfo->fs;
if (pfo->lf.lfEscapement && pfo->lpX11Trans)
rotated = TRUE;
dfBreakChar = (char)pfo->fi->df.dfBreakChar;
......
......@@ -206,6 +206,10 @@ static const SuffixCharset sufch_iso10646[] = {
{ "1", DEFAULT_CHARSET, 0, X11DRV_CPTABLE_UNICODE },
{ NULL, DEFAULT_CHARSET, 0, X11DRV_CPTABLE_UNICODE }};
static const SuffixCharset sufch_dec[] = {
{ "dectech", SYMBOL_CHARSET, CP_SYMBOL, X11DRV_CPTABLE_SBCS },
{ NULL, 0, 0, X11DRV_CPTABLE_SBCS }};
/* Each of these must be matched explicitly */
static const SuffixCharset sufch_any[] = {
{ "fontspecific", SYMBOL_CHARSET, CP_SYMBOL, X11DRV_CPTABLE_SBCS },
......@@ -244,6 +248,7 @@ static fontEncodingTemplate __fETTable[] = {
{ "unicode", sufch_unicode, &__fETTable[19]},
{ "iso10646", sufch_iso10646, &__fETTable[20]},
{ "cp", sufch_windows, &__fETTable[21]},
{ "dec", sufch_dec, &__fETTable[22]},
/* NULL prefix matches anything so put it last */
{ NULL, sufch_any, NULL },
};
......@@ -2919,6 +2924,10 @@ int X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y )
RAW_ASCENT = TSXInternAtom(gdi_display, "RAW_ASCENT", TRUE);
RAW_DESCENT = TSXInternAtom(gdi_display, "RAW_DESCENT", TRUE);
if(X11DRV_XRender_Installed)
XTextCaps |= TC_VA_ABLE;
return XTextCaps;
}
......@@ -3166,10 +3175,16 @@ HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont )
LOGFONT16 lf;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TRACE("dc=%p, hfont=%04x\n", dc, hfont);
if (!GetObjectW( hfont, sizeof(logfont), &logfont )) return GDI_ERROR;
/* If we want to use a gdi font, we should check for XRender extension
and return FALSE here */
TRACE("dc->gdiFont = %p\n", dc->gdiFont);
if(dc->gdiFont && X11DRV_XRender_Installed) {
X11DRV_XRender_SelectFont(dc, hfont);
return FALSE;
}
EnterCriticalSection( &crtsc_fonts_X11 );
......
......@@ -58,6 +58,8 @@ typedef struct
/* X physical font */
typedef UINT X_PHYSFONT;
typedef struct tagXRENDERINFO *XRENDERINFO;
/* X physical device */
typedef struct
{
......@@ -72,6 +74,7 @@ typedef struct
XVisualInfo *visuals[MAX_PIXELFORMATS];
int used_visuals;
int current_pf;
XRENDERINFO xrender;
} X11DRV_PDEVICE;
......@@ -196,6 +199,16 @@ extern const int X11DRV_XROPfunction[];
extern void _XInitImageFuncPtrs(XImage *);
extern BOOL X11DRV_XRender_Installed;
extern void X11DRV_XRender_Init(void);
extern void X11DRV_XRender_Finalize(void);
extern BOOL X11DRV_XRender_SelectFont(struct tagDC*, HFONT);
extern void X11DRV_XRender_DeleteDC(struct tagDC*);
extern BOOL X11DRV_XRender_ExtTextOut(DC *dc, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR wstr,
UINT count, const INT *lpDx);
extern void X11DRV_XRender_UpdateDrawable(DC *dc);
/* exported dib functions for now */
/* Additional info for DIB section objects */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment