gdi32: Cache the font smoothing parameters.

This commit is contained in:
Alexandre Julliard 2013-06-24 12:41:40 +02:00
parent 96ab188f73
commit e4300d6165
1 changed files with 15 additions and 6 deletions

View File

@ -781,6 +781,7 @@ HFONT nulldrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags )
{
static const WCHAR desktopW[] = { 'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
'D','e','s','k','t','o','p',0 };
static int orientation = -1, smoothing = -1;
LOGFONTW lf;
HKEY key;
@ -797,14 +798,22 @@ HFONT nulldrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags )
break;
case CLEARTYPE_QUALITY:
case CLEARTYPE_NATURAL_QUALITY:
if (RegOpenKeyW( HKEY_CURRENT_USER, desktopW, &key )) break;
*aa_flags = get_subpixel_orientation( key );
RegCloseKey( key );
if (orientation == -1)
{
if (RegOpenKeyW( HKEY_CURRENT_USER, desktopW, &key )) break;
orientation = get_subpixel_orientation( key );
RegCloseKey( key );
}
*aa_flags = orientation;
break;
default:
if (RegOpenKeyW( HKEY_CURRENT_USER, desktopW, &key )) break;
*aa_flags = get_default_smoothing( key );
RegCloseKey( key );
if (smoothing == -1)
{
if (RegOpenKeyW( HKEY_CURRENT_USER, desktopW, &key )) break;
smoothing = get_default_smoothing( key );
RegCloseKey( key );
}
*aa_flags = smoothing;
break;
}
return 0;