gdi32: Disable anti-aliasing when necessary in the various drivers.

This commit is contained in:
Alexandre Julliard 2012-10-31 16:07:51 +01:00
parent ccc034c27e
commit 9cdb0e1ca6
8 changed files with 30 additions and 10 deletions

View File

@ -484,7 +484,7 @@ const struct gdi_dc_funcs dib_driver =
dibdrv_SelectBitmap, /* pSelectBitmap */
dibdrv_SelectBrush, /* pSelectBrush */
NULL, /* pSelectClipPath */
NULL, /* pSelectFont */
dibdrv_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */
dibdrv_SelectPen, /* pSelectPen */
NULL, /* pSetArcDirection */

View File

@ -141,6 +141,7 @@ extern BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT
extern BOOL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT ellipse_width, INT ellipse_height ) DECLSPEC_HIDDEN;
extern HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
extern HFONT dibdrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags ) DECLSPEC_HIDDEN;
extern HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
extern COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;

View File

@ -711,6 +711,19 @@ done:
return TRUE;
}
/***********************************************************************
* dibdrv_SelectFont
*/
HFONT dibdrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags )
{
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
if (pdev->dib.bit_count <= 8) *aa_flags = GGO_BITMAP; /* no anti-aliasing on <= 8bpp */
dev = GET_NEXT_PHYSDEV( dev, pSelectFont );
return dev->funcs->pSelectFont( dev, font, aa_flags );
}
/***********************************************************************
* dibdrv_Arc
*/

View File

@ -314,6 +314,7 @@ HFONT EMFDRV_SelectFont( PHYSDEV dev, HFONT hFont, UINT *aa_flags )
if(!EMFDRV_WriteRecord( dev, &emr.emr ))
return 0;
done:
*aa_flags = GGO_BITMAP; /* no point in anti-aliasing on metafiles */
dev = GET_NEXT_PHYSDEV( dev, pSelectFont );
dev->funcs->pSelectFont( dev, hFont, aa_flags );
return hFont;

View File

@ -397,14 +397,6 @@ UINT get_font_aa_flags( HDC hdc, const LOGFONTW *lf )
static int subpixel_enabled = -1;
enum smoothing smoothing;
if (GetObjectType( hdc ) == OBJ_MEMDC)
{
BITMAP bm;
GetObjectW( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bm), &bm );
if (bm.bmBitsPixel <= 8) return GGO_BITMAP;
}
else if (GetDeviceCaps( hdc, BITSPIXEL ) <= 8) return GGO_BITMAP;
if (hinter == -1 || subpixel_enabled == -1)
{
RASTERIZER_STATUS status;

View File

@ -290,6 +290,7 @@ HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
LOGFONTW font;
INT16 index;
*aa_flags = GGO_BITMAP; /* no point in anti-aliasing on metafiles */
index = MFDRV_FindObject(dev, hfont);
if( index < 0 )
{

View File

@ -47,6 +47,8 @@ HFONT PSDRV_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
if (!GetObjectW( hfont, sizeof(lf), &lf )) return 0;
*aa_flags = GGO_BITMAP; /* no anti-aliasing on printer devices */
TRACE("FaceName = %s Height = %d Italic = %d Weight = %d\n",
debugstr_w(lf.lfFaceName), lf.lfHeight, lf.lfItalic,
lf.lfWeight);

View File

@ -295,6 +295,16 @@ static INT X11DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
}
/***********************************************************************
* SelectFont
*/
static HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
{
if (default_visual.depth <= 8) *aa_flags = GGO_BITMAP; /* no anti-aliasing on <= 8bpp */
dev = GET_NEXT_PHYSDEV( dev, pSelectFont );
return dev->funcs->pSelectFont( dev, hfont, aa_flags );
}
/**********************************************************************
* ExtEscape (X11DRV.@)
*/
@ -532,7 +542,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pSelectBitmap */
X11DRV_SelectBrush, /* pSelectBrush */
NULL, /* pSelectClipPath */
NULL, /* pSelectFont */
X11DRV_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */
X11DRV_SelectPen, /* pSelectPen */
NULL, /* pSetArcDirection */