Alexandre Julliard : gdi32: Cache the font smoothing parameters.

Alexandre Julliard julliard at winehq.org
Mon Jun 24 16:23:47 CDT 2013


Module: wine
Branch: master
Commit: e4300d616500e1346e1935f14255f082e1097f20
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e4300d616500e1346e1935f14255f082e1097f20

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jun 24 12:41:40 2013 +0200

gdi32: Cache the font smoothing parameters.

---

 dlls/gdi32/font.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 8fb101f..c6bd65b 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -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;




More information about the wine-cvs mailing list