Aric Stewart : usp10: Cache OUTLINETEXTMETRICW in addition to TEXTMETRICW.

Alexandre Julliard julliard at winehq.org
Mon Aug 13 13:21:18 CDT 2012


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Tue Jul 31 08:49:57 2012 -0500

usp10: Cache OUTLINETEXTMETRICW in addition to TEXTMETRICW.

---

 dlls/usp10/usp10.c          |    9 +++++++++
 dlls/usp10/usp10_internal.h |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 9659e66..9bd55b4 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -788,6 +788,7 @@ static inline BOOL set_cache_glyph_widths(SCRIPT_CACHE *psc, WORD glyph, ABC *ab
 static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
 {
     ScriptCache *sc;
+    int size;
 
     if (!psc) return E_INVALIDARG;
     if (*psc) return S_OK;
@@ -799,6 +800,13 @@ static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
         heap_free(sc);
         return E_INVALIDARG;
     }
+    size = GetOutlineTextMetricsW(hdc, 0, NULL);
+    if (size)
+    {
+        sc->otm = heap_alloc(size);
+        sc->otm->otmSize = size;
+        GetOutlineTextMetricsW(hdc, size, sc->otm);
+    }
     if (!GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(LOGFONTW), &sc->lf))
     {
         heap_free(sc);
@@ -998,6 +1006,7 @@ HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
             heap_free(((ScriptCache *)*psc)->scripts[i].languages);
         }
         heap_free(((ScriptCache *)*psc)->scripts);
+        heap_free(((ScriptCache *)*psc)->otm);
         heap_free(*psc);
         *psc = NULL;
     }
diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h
index 15553eb..674db89 100644
--- a/dlls/usp10/usp10_internal.h
+++ b/dlls/usp10/usp10_internal.h
@@ -159,6 +159,7 @@ typedef struct {
 typedef struct {
     LOGFONTW lf;
     TEXTMETRICW tm;
+    OUTLINETEXTMETRICW *otm;
     BOOL sfnt;
     CacheGlyphPage *page[0x10];
     ABC *widths[GLYPH_MAX / GLYPH_BLOCK_SIZE];




More information about the wine-cvs mailing list