Alexandre Julliard : gdi32: Determine the default anti-aliasing parameters in the null driver SelectFont entry point .
Alexandre Julliard
julliard at winehq.org
Mon Nov 5 13:32:24 CST 2012
Module: wine
Branch: master
Commit: 5c02c352d9df394fa97a45965c8d32ddcb1abcd9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5c02c352d9df394fa97a45965c8d32ddcb1abcd9
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Nov 5 12:32:15 2012 +0100
gdi32: Determine the default anti-aliasing parameters in the null driver SelectFont entry point.
---
dlls/gdi32/driver.c | 5 --
dlls/gdi32/font.c | 93 ++++++++++++++++++++++------------------------
dlls/gdi32/freetype.c | 48 +++++++++++++++--------
dlls/gdi32/gdi_private.h | 4 +-
4 files changed, 76 insertions(+), 74 deletions(-)
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 2ab0778..f5cadbe 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -552,11 +552,6 @@ static HBRUSH nulldrv_SelectBrush( PHYSDEV dev, HBRUSH brush, const struct brush
return brush;
}
-static HFONT nulldrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags )
-{
- return 0;
-}
-
static HPALETTE nulldrv_SelectPalette( PHYSDEV dev, HPALETTE palette, BOOL bkgnd )
{
return palette;
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 09ea1b7..b289fa9 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -260,8 +260,6 @@ static void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, NEWTEXTMETRIC
memcpy(&ptmA->ntmFontSig, &ptmW->ntmFontSig, sizeof(FONTSIGNATURE));
}
-enum smoothing { no_smoothing, aa_smoothing, subpixel_smoothing };
-
static DWORD get_desktop_value( const WCHAR *name, DWORD *value )
{
static const WCHAR desktop[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
@@ -279,28 +277,6 @@ static DWORD get_desktop_value( const WCHAR *name, DWORD *value )
return err;
}
-static enum smoothing get_default_smoothing( void )
-{
- static const WCHAR smoothing_type[] = {'F','o','n','t','S','m','o','o','t','h','i','n','g','T','y','p','e',0};
- DWORD type, err;
-
- /* FIXME: Ignoring FontSmoothing for now since this is
- set to off by default in wine.inf */
-
- err = get_desktop_value( smoothing_type, &type );
- if (err) return aa_smoothing;
-
- switch (type)
- {
- case 1: /* FE_FONTSMOOTHINGSTANDARD */
- return aa_smoothing;
- case 2: /* FE_FONTSMOOTHINGCLEARTYPE */
- return subpixel_smoothing;
- }
-
- return aa_smoothing;
-}
-
static UINT get_subpixel_orientation( void )
{
static const WCHAR smoothing_orientation[] = {'F','o','n','t','S','m','o','o','t','h','i','n','g',
@@ -321,39 +297,28 @@ static UINT get_subpixel_orientation( void )
return GGO_GRAY4_BITMAP;
}
-UINT get_font_aa_flags( HDC hdc, const LOGFONTW *lf )
+static UINT get_default_smoothing( void )
{
- enum smoothing smoothing;
+ static const WCHAR smoothing_type[] = {'F','o','n','t','S','m','o','o','t','h','i','n','g','T','y','p','e',0};
+ DWORD type, err;
- switch (lf->lfQuality)
- {
- case NONANTIALIASED_QUALITY:
- return GGO_BITMAP;
- case ANTIALIASED_QUALITY:
- smoothing = aa_smoothing;
- break;
- case CLEARTYPE_QUALITY:
- case CLEARTYPE_NATURAL_QUALITY:
- smoothing = subpixel_smoothing;
- break;
- case DEFAULT_QUALITY:
- case DRAFT_QUALITY:
- case PROOF_QUALITY:
- default:
- smoothing = get_default_smoothing();
- }
+ /* FIXME: Ignoring FontSmoothing for now since this is
+ set to off by default in wine.inf */
- switch (smoothing)
+ err = get_desktop_value( smoothing_type, &type );
+ if (err) return 0;
+
+ switch (type)
{
- case subpixel_smoothing:
- return get_subpixel_orientation();
- case aa_smoothing:
+ case 1: /* FE_FONTSMOOTHINGSTANDARD */
return GGO_GRAY4_BITMAP;
- default:
- return GGO_BITMAP;
+ case 2: /* FE_FONTSMOOTHINGCLEARTYPE */
+ return get_subpixel_orientation();
}
+ return 0;
}
+
/***********************************************************************
* GdiGetCodePage (GDI32.@)
*/
@@ -697,6 +662,36 @@ static BOOL FONT_DeleteObject( HGDIOBJ handle )
/***********************************************************************
+ * nulldrv_SelectFont
+ */
+HFONT nulldrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags )
+{
+ LOGFONTW lf;
+
+ if (*aa_flags) return 0;
+
+ GetObjectW( font, sizeof(lf), &lf );
+ switch (lf.lfQuality)
+ {
+ case NONANTIALIASED_QUALITY:
+ *aa_flags = GGO_BITMAP;
+ break;
+ case ANTIALIASED_QUALITY:
+ *aa_flags = GGO_GRAY4_BITMAP;
+ break;
+ case CLEARTYPE_QUALITY:
+ case CLEARTYPE_NATURAL_QUALITY:
+ *aa_flags = get_subpixel_orientation();
+ break;
+ default:
+ *aa_flags = get_default_smoothing();
+ break;
+ }
+ return 0;
+}
+
+
+/***********************************************************************
* FONT_EnumInstance
*
* Note: plf is really an ENUMLOGFONTEXW, and ptm is a NEWTEXTMETRICEXW.
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 98c7b40..fcdcca9 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -4953,27 +4953,41 @@ found_face:
done:
if (ret)
{
- if (!*aa_flags) *aa_flags = ret->aa_flags;
- if (!*aa_flags) *aa_flags = get_font_aa_flags( dev->hdc, &lf );
+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectFont );
- /* fixup the antialiasing flags for that font */
- switch (*aa_flags)
+ switch (lf.lfQuality)
{
- case WINE_GGO_HRGB_BITMAP:
- case WINE_GGO_HBGR_BITMAP:
- case WINE_GGO_VRGB_BITMAP:
- case WINE_GGO_VBGR_BITMAP:
- if (is_subpixel_rendering_enabled()) break;
- *aa_flags = GGO_GRAY4_BITMAP;
- /* fall through */
- case GGO_GRAY4_BITMAP:
- if (is_hinting_enabled())
+ case NONANTIALIASED_QUALITY:
+ case ANTIALIASED_QUALITY:
+ next->funcs->pSelectFont( dev, hfont, aa_flags );
+ break;
+ case CLEARTYPE_QUALITY:
+ case CLEARTYPE_NATURAL_QUALITY:
+ default:
+ if (!*aa_flags) *aa_flags = ret->aa_flags;
+ next->funcs->pSelectFont( dev, hfont, aa_flags );
+
+ /* fixup the antialiasing flags for that font */
+ switch (*aa_flags)
{
- WORD gasp_flags;
- if (get_gasp_flags( ret, &gasp_flags ) && !(gasp_flags & GASP_DOGRAY))
- *aa_flags = GGO_BITMAP;
+ case WINE_GGO_HRGB_BITMAP:
+ case WINE_GGO_HBGR_BITMAP:
+ case WINE_GGO_VRGB_BITMAP:
+ case WINE_GGO_VBGR_BITMAP:
+ if (is_subpixel_rendering_enabled()) break;
+ *aa_flags = GGO_GRAY4_BITMAP;
+ /* fall through */
+ case GGO_GRAY2_BITMAP:
+ case GGO_GRAY4_BITMAP:
+ case GGO_GRAY8_BITMAP:
+ case WINE_GGO_GRAY16_BITMAP:
+ if (is_hinting_enabled())
+ {
+ WORD gasp_flags;
+ if (get_gasp_flags( ret, &gasp_flags ) && !(gasp_flags & GASP_DOGRAY))
+ *aa_flags = GGO_BITMAP;
+ }
}
- break;
}
dc->gdiFont = ret;
physdev->font = ret;
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 084245e..e3fe577 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -278,9 +278,6 @@ extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DE
/* enhmetafile.c */
extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) DECLSPEC_HIDDEN;
-/* font.c */
-extern UINT get_font_aa_flags( HDC hdc, const LOGFONTW *lf ) DECLSPEC_HIDDEN;
-
/* freetype.c */
/* Undocumented structure filled in by GdiRealizationInfo */
@@ -394,6 +391,7 @@ extern INT nulldrv_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL nulldrv_SelectClipPath( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
+extern HFONT nulldrv_SelectFont( PHYSDEV dev, HFONT font, UINT *ggo_flags ) DECLSPEC_HIDDEN;
extern INT nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD width, DWORD height,
INT x_src, INT y_src, UINT start, UINT lines,
const void *bits, BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list