https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6f6f4d1501ad11caf567d66b25390022406ed698

commit 6f6f4d1501ad11caf567d66b25390022406ed698
Author:     winesync <[email protected]>
AuthorDate: Mon Sep 21 23:03:28 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:05 2021 +0100

    [WINESYNC] d3dx9: Implement ID3DXFont_PreloadCharacters.
    
    Based on a patch by Tony Wasserka.
    
    Signed-off-by: Sven Baars <[email protected]>
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 21fc1f37e76eaced9228eaf62a45489a2bf8ac11 by Sven Baars 
<[email protected]>
---
 dll/directx/wine/d3dx9_36/font.c | 46 ++++++++++++++++++++++++++++++++++++++--
 sdk/tools/winesync/d3dx9.cfg     |  2 +-
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c
index c2cdde37f8f..11e20ed2bdc 100644
--- a/dll/directx/wine/d3dx9_36/font.c
+++ b/dll/directx/wine/d3dx9_36/font.c
@@ -224,8 +224,50 @@ static HRESULT WINAPI ID3DXFontImpl_GetGlyphData(ID3DXFont 
*iface, UINT glyph,
 
 static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters(ID3DXFont *iface, UINT 
first, UINT last)
 {
-    FIXME("iface %p, first %u, last %u stub!\n", iface, first, last);
-    return S_OK;
+    struct d3dx_font *font = impl_from_ID3DXFont(iface);
+    unsigned int i, count, start, end;
+    WORD *indices;
+    WCHAR *chars;
+
+    TRACE("iface %p, first %u, last %u.\n", iface, first, last);
+
+    if (last < first)
+        return D3D_OK;
+
+    count = last - first + 1;
+    indices = heap_alloc(count * sizeof(*indices));
+    if (!indices)
+        return E_OUTOFMEMORY;
+
+    chars = heap_alloc(count * sizeof(*chars));
+    if (!chars)
+    {
+        heap_free(indices);
+        return E_OUTOFMEMORY;
+    }
+
+    for (i = 0; i < count; ++i)
+        chars[i] = first + i;
+
+    GetGlyphIndicesW(font->hdc, chars, count, indices, 0);
+
+    start = end = indices[0];
+    for (i = 1; i < count; ++i)
+    {
+        if (indices[i] == end + 1)
+        {
+            end = indices[i];
+            continue;
+        }
+        ID3DXFont_PreloadGlyphs(iface, start, end);
+        start = end = indices[i];
+    }
+    ID3DXFont_PreloadGlyphs(iface, start, end);
+
+    heap_free(chars);
+    heap_free(indices);
+
+    return D3D_OK;
 }
 
 static uint32_t morton_decode(uint32_t x)
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 3948abeff75..0181a5fd9b2 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, 
include/d3dx9anim.h: sdk/inc
   include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: 
sdk/include/dxsdk/d3dx9of.h,
   include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, 
include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
   include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: 
sdk/include/dxsdk/d3dx9xof.h}
-tags: {wine: e9ea8a05e54f1c950e5c15979d1393ad013402b1}
+tags: {wine: 21fc1f37e76eaced9228eaf62a45489a2bf8ac11}

Reply via email to