winex11.drv: Add the basic antialias type decision code.

This commit is contained in:
Byeongsik Jeon 2008-12-31 11:43:42 +09:00 committed by Alexandre Julliard
parent 04b8ec07a6
commit 3807ca733d
2 changed files with 56 additions and 14 deletions

View File

@ -451,14 +451,45 @@ static BOOL get_gasp_flags(X11DRV_PDEVICE *physDev, WORD *flags)
return TRUE; return TRUE;
} }
static AA_Type get_antialias_type( X11DRV_PDEVICE *physDev, BOOL subpixel, BOOL hinter)
{
AA_Type ret;
WORD flags;
UINT font_smoothing_type, font_smoothing_orientation;
if (X11DRV_XRender_Installed && subpixel &&
SystemParametersInfoW( SPI_GETFONTSMOOTHINGTYPE, 0, &font_smoothing_type, 0) &&
font_smoothing_type == FE_FONTSMOOTHINGCLEARTYPE)
{
if ( SystemParametersInfoW( SPI_GETFONTSMOOTHINGORIENTATION, 0,
&font_smoothing_orientation, 0) &&
font_smoothing_orientation == FE_FONTSMOOTHINGORIENTATIONBGR)
{
ret = AA_BGR;
}
else
ret = AA_RGB;
/*FIXME
If the monitor is in portrait mode, ClearType is disabled in the MS Windows (MSDN).
But, Wine's subpixel rendering can support the portrait mode.
*/
}
else if (!hinter || !get_gasp_flags(physDev, &flags) || flags & GASP_DOGRAY)
ret = AA_Grey;
else
ret = AA_None;
return ret;
}
static int GetCacheEntry(X11DRV_PDEVICE *physDev, LFANDSIZE *plfsz) static int GetCacheEntry(X11DRV_PDEVICE *physDev, LFANDSIZE *plfsz)
{ {
int ret; int ret;
int format; int format;
gsCacheEntry *entry; gsCacheEntry *entry;
WORD flags;
static int hinter = -1; static int hinter = -1;
static int subpixel = -1; static int subpixel = -1;
BOOL font_smoothing;
if((ret = LookupEntry(plfsz)) != -1) return ret; if((ret = LookupEntry(plfsz)) != -1) return ret;
@ -479,19 +510,28 @@ static int GetCacheEntry(X11DRV_PDEVICE *physDev, LFANDSIZE *plfsz)
subpixel = status.wFlags & WINE_TT_SUBPIXEL_RENDERING_ENABLED; subpixel = status.wFlags & WINE_TT_SUBPIXEL_RENDERING_ENABLED;
} }
/* FIXME: Use the following registry information switch (plfsz->lf.lfQuality)
[HKEY_CURRENT_USER\Control Panel\Desktop] {
"FontSmoothing"="2" ; 0=>Off, 2=>On case ANTIALIASED_QUALITY:
"FontSmoothingType"=dword:00000002 ; 1=>Standard, 2=>Cleartype entry->aa_default = get_antialias_type( physDev, FALSE, hinter );
"FontSmoothingOrientation"=dword:00000001 ; 0=>BGR, 1=>RGB break;
"FontSmoothingGamma"=dword:00000578 case CLEARTYPE_QUALITY:
*/ case CLEARTYPE_NATURAL_QUALITY:
if ( subpixel && X11DRV_XRender_Installed) entry->aa_default = get_antialias_type( physDev, subpixel, hinter );
entry->aa_default = AA_RGB; break;
else if(!hinter || !get_gasp_flags(physDev, &flags) || flags & GASP_DOGRAY) case DEFAULT_QUALITY:
entry->aa_default = AA_Grey; case DRAFT_QUALITY:
else case PROOF_QUALITY:
entry->aa_default = AA_None; default:
if ( SystemParametersInfoW( SPI_GETFONTSMOOTHING, 0, &font_smoothing, 0) &&
font_smoothing)
{
entry->aa_default = get_antialias_type( physDev, subpixel, hinter );
}
else
entry->aa_default = AA_None;
break;
}
} }
else else
entry->aa_default = AA_None; entry->aa_default = AA_None;

View File

@ -771,6 +771,8 @@ typedef struct tagXFORM
#define PROOF_QUALITY 2 #define PROOF_QUALITY 2
#define NONANTIALIASED_QUALITY 3 #define NONANTIALIASED_QUALITY 3
#define ANTIALIASED_QUALITY 4 #define ANTIALIASED_QUALITY 4
#define CLEARTYPE_QUALITY 5
#define CLEARTYPE_NATURAL_QUALITY 6
/* lfPitchAndFamily pitch values */ /* lfPitchAndFamily pitch values */
#define DEFAULT_PITCH 0x00 #define DEFAULT_PITCH 0x00