Huw Davies : gdi32: Don't call GetObjectW() unless necessary.

Alexandre Julliard julliard at winehq.org
Fri Jul 29 10:17:09 CDT 2016


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Jul 29 13:13:07 2016 +0100

gdi32: Don't call GetObjectW() unless necessary.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/font.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 2faefe8..02efc8a 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -681,13 +681,15 @@ static void update_font_code_page( DC *dc, HANDLE font )
 {
     CHARSETINFO csi;
     int charset = get_text_charset_info( dc, NULL, 0 );
-    LOGFONTW lf;
 
-    GetObjectW( font, sizeof(lf), &lf );
+    if (charset == ANSI_CHARSET && get_associated_charset_info() & ASSOC_CHARSET_ANSI)
+    {
+        LOGFONTW lf;
 
-    if (charset == ANSI_CHARSET && !(lf.lfClipPrecision & CLIP_DFA_DISABLE) &&
-        get_associated_charset_info() & ASSOC_CHARSET_ANSI)
-        charset = DEFAULT_CHARSET;
+        GetObjectW( font, sizeof(lf), &lf );
+        if (!(lf.lfClipPrecision & CLIP_DFA_DISABLE))
+            charset = DEFAULT_CHARSET;
+    }
 
     /* Hmm, nicely designed api this one! */
     if (TranslateCharsetInfo( ULongToPtr(charset), &csi, TCI_SRCCHARSET) )




More information about the wine-cvs mailing list