Sven Baars : d3dx9: Implement ID3DXFont_PreloadCharacters.
Alexandre Julliard
julliard at winehq.org
Thu Feb 27 17:15:10 CST 2020
Module: wine
Branch: master
Commit: 21fc1f37e76eaced9228eaf62a45489a2bf8ac11
URL: https://source.winehq.org/git/wine.git/?a=commit;h=21fc1f37e76eaced9228eaf62a45489a2bf8ac11
Author: Sven Baars <sbaars at codeweavers.com>
Date: Thu Feb 27 13:01:41 2020 +0100
d3dx9: Implement ID3DXFont_PreloadCharacters.
Based on a patch by Tony Wasserka.
Signed-off-by: Sven Baars <sbaars at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dx9_36/font.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index af743310d1..9196295637 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -220,8 +220,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)
More information about the wine-cvs
mailing list