d3dx10/font: Add PreloadCharacters().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-09-01 16:09:35 +03:00 committed by Alexandre Julliard
parent abbab131b8
commit c09f114319
2 changed files with 43 additions and 5 deletions

View File

@ -168,9 +168,50 @@ static HRESULT WINAPI d3dx_font_GetGlyphData(ID3DX10Font *iface, UINT glyph,
static HRESULT WINAPI d3dx_font_PreloadCharacters(ID3DX10Font *iface, UINT first, UINT last)
{
FIXME("iface %p, first %u, last %u stub!\n", iface, first, last);
struct d3dx_font *font = impl_from_ID3DX10Font(iface);
unsigned int i, count, start, end;
WORD *indices;
WCHAR *chars;
return E_NOTIMPL;
TRACE("iface %p, first %u, last %u.\n", iface, first, last);
if (last < first)
return S_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;
}
ID3DX10Font_PreloadGlyphs(iface, start, end);
start = end = indices[i];
}
ID3DX10Font_PreloadGlyphs(iface, start, end);
heap_free(chars);
heap_free(indices);
return S_OK;
}
static HRESULT WINAPI d3dx_font_PreloadGlyphs(ID3DX10Font *iface, UINT first, UINT last)

View File

@ -2307,14 +2307,12 @@ todo_wine
ID3D10ShaderResourceView_Release(srv);
hr = ID3DX10Font_PreloadCharacters(font, 'b', 'a');
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadGlyphs(font, 1, 0);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadCharacters(font, 'a', 'a');
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
for (c = 'b'; c <= 'z'; ++c)
@ -2376,7 +2374,6 @@ todo_wine
}
hr = ID3DX10Font_PreloadCharacters(font, 'a', 'z');
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
/* Test multiple textures */