Commit ccc034c2 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Store the anti-aliasing flags in the DC when selecting a font.

parent 6164d533
......@@ -665,7 +665,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
{
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
struct clipped_rects clipped_rects;
UINT aa_flags;
DC *dc;
RECT bounds;
DWORD text_color;
struct intensity_range ranges[17];
......@@ -700,10 +700,10 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
text_color = get_pixel_color( pdev, GetTextColor( pdev->dev.hdc ), TRUE );
get_aa_ranges( pdev->dib.funcs->pixel_to_colorref( &pdev->dib, text_color ), ranges );
aa_flags = get_font_aa_flags( dev->hdc );
render_string( dev->hdc, &pdev->dib, x, y, flags, aa_flags, str, count, dx,
dc = get_dc_ptr( dev->hdc );
render_string( dev->hdc, &pdev->dib, x, y, flags, dc->aa_flags, str, count, dx,
text_color, ranges, &clipped_rects, &bounds );
release_dc_ptr( dc );
done:
add_clipped_bounds( pdev, &bounds, pdev->clip );
......
......@@ -390,9 +390,8 @@ static UINT get_subpixel_orientation( void )
return GGO_GRAY4_BITMAP;
}
UINT get_font_aa_flags( HDC hdc )
UINT get_font_aa_flags( HDC hdc, const LOGFONTW *lf )
{
LOGFONTW lf;
WORD gasp_flags;
static int hinter = -1;
static int subpixel_enabled = -1;
......@@ -406,9 +405,6 @@ UINT get_font_aa_flags( HDC hdc )
}
else if (GetDeviceCaps( hdc, BITSPIXEL ) <= 8) return GGO_BITMAP;
GetObjectW( GetCurrentObject( hdc, OBJ_FONT ), sizeof(lf), &lf );
if (lf.lfQuality == NONANTIALIASED_QUALITY) return GGO_BITMAP;
if (hinter == -1 || subpixel_enabled == -1)
{
RASTERIZER_STATUS status;
......@@ -417,8 +413,10 @@ UINT get_font_aa_flags( HDC hdc )
subpixel_enabled = status.wFlags & WINE_TT_SUBPIXEL_RENDERING_ENABLED;
}
switch (lf.lfQuality)
switch (lf->lfQuality)
{
case NONANTIALIASED_QUALITY:
return GGO_BITMAP;
case ANTIALIASED_QUALITY:
smoothing = aa_smoothing;
break;
......@@ -731,6 +729,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
{
ret = dc->hFont;
dc->hFont = handle;
dc->aa_flags = aa_flags ? aa_flags : GGO_BITMAP;
update_font_code_page( dc );
GDI_dec_ref_count( ret );
}
......@@ -1948,7 +1947,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect
LPCWSTR str, UINT count, const INT *dx )
{
DC *dc = get_nulldrv_dc( dev );
UINT aa_flags, i;
UINT i;
DWORD err;
HGDIOBJ orig;
HPEN pen;
......@@ -1970,18 +1969,15 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect
if (!count) return TRUE;
aa_flags = get_font_aa_flags( dev->hdc );
if (aa_flags != GGO_BITMAP)
if (dc->aa_flags != GGO_BITMAP)
{
char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
BITMAPINFO *info = (BITMAPINFO *)buffer;
struct gdi_image_bits bits;
struct bitblt_coords src, dst;
PHYSDEV dst_dev;
/* FIXME Subpixel modes */
aa_flags = GGO_GRAY4_BITMAP;
UINT aa_flags = GGO_GRAY4_BITMAP;
dst_dev = GET_DC_PHYSDEV( dc, pPutImage );
src.visrect = get_total_extents( dev->hdc, x, y, flags, aa_flags, str, count, dx );
......
......@@ -4459,6 +4459,8 @@ static HFONT freetype_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
GetObjectW( hfont, sizeof(lf), &lf );
lf.lfWidth = abs(lf.lfWidth);
if (!*aa_flags) *aa_flags = get_font_aa_flags( dev->hdc, &lf );
can_use_bitmap = GetDeviceCaps(dev->hdc, TEXTCAPS) & TC_RA_ABLE;
TRACE("%s, h=%d, it=%d, weight=%d, PandF=%02x, charset=%d orient %d escapement %d\n",
......
......@@ -88,6 +88,7 @@ typedef struct tagDC
RECT vis_rect; /* visible rectangle in screen coords */
RECT device_rect; /* rectangle for the whole device */
int pixel_format; /* pixel format (for memory DCs) */
UINT aa_flags; /* anti-aliasing flags to pass to GetGlyphOutline for current font */
FLOAT miterLimit;
int flags;
......@@ -278,7 +279,7 @@ extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DE
extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) DECLSPEC_HIDDEN;
/* font.c */
extern UINT get_font_aa_flags( HDC hdc ) DECLSPEC_HIDDEN;
extern UINT get_font_aa_flags( HDC hdc, const LOGFONTW *lf ) DECLSPEC_HIDDEN;
/* freetype.c */
......
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