https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ea944e7a9e158b7878ca6…
commit ea944e7a9e158b7878ca6b5d9813e4edaaf6899f
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Mon Sep 21 23:03:28 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Thu Feb 4 16:37:05 2021 +0100
[WINESYNC] d3dx9: Implement ID3DXFont_GetGlyphData.
Based on a patch by Tony Wasserka.
Signed-off-by: Sven Baars <sbaars(a)codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id e9ea8a05e54f1c950e5c15979d1393ad013402b1 by Sven Baars
<sbaars(a)codeweavers.com>
---
dll/directx/wine/d3dx9_36/font.c | 35 +++++++++++++++++---
modules/rostests/winetests/d3dx9_36/core.c | 53 ++++++++++++++----------------
sdk/tools/winesync/d3dx9.cfg | 2 +-
3 files changed, 56 insertions(+), 34 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c
index 388f73d7efb..c2cdde37f8f 100644
--- a/dll/directx/wine/d3dx9_36/font.c
+++ b/dll/directx/wine/d3dx9_36/font.c
@@ -188,11 +188,38 @@ static HDC WINAPI ID3DXFontImpl_GetDC(ID3DXFont *iface)
}
static HRESULT WINAPI ID3DXFontImpl_GetGlyphData(ID3DXFont *iface, UINT glyph,
- IDirect3DTexture9 **texture, RECT *blackbox, POINT *cellinc)
+ IDirect3DTexture9 **texture, RECT *black_box, POINT *cell_inc)
{
- FIXME("iface %p, glyph %#x, texture %p, blackbox %p, cellinc %p stub!\n",
- iface, glyph, texture, blackbox, cellinc);
- return E_NOTIMPL;
+ struct d3dx_font *font = impl_from_ID3DXFont(iface);
+ struct wine_rb_entry *entry;
+ HRESULT hr;
+
+ TRACE("iface %p, glyph %#x, texture %p, black_box %p, cell_inc %p.\n",
+ iface, glyph, texture, black_box, cell_inc);
+
+ hr = ID3DXFont_PreloadGlyphs(iface, glyph, glyph);
+ if (FAILED(hr))
+ return hr;
+
+ entry = wine_rb_get(&font->glyph_tree, ULongToPtr(glyph));
+ if (entry)
+ {
+ struct d3dx_glyph *current_glyph = WINE_RB_ENTRY_VALUE(entry, struct d3dx_glyph,
entry);
+
+ if (cell_inc)
+ *cell_inc = current_glyph->cell_inc;
+ if (black_box)
+ *black_box = current_glyph->black_box;
+ if (texture)
+ {
+ *texture = current_glyph->texture;
+ if (*texture)
+ IDirect3DTexture9_AddRef(current_glyph->texture);
+ }
+ return D3D_OK;
+ }
+
+ return D3DXERR_INVALIDDATA;
}
static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters(ID3DXFont *iface, UINT first, UINT
last)
diff --git a/modules/rostests/winetests/d3dx9_36/core.c
b/modules/rostests/winetests/d3dx9_36/core.c
index 22d265b9fc7..b8e680d1c55 100644
--- a/modules/rostests/winetests/d3dx9_36/core.c
+++ b/modules/rostests/winetests/d3dx9_36/core.c
@@ -543,16 +543,15 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
hdc = ID3DXFont_GetDC(font);
ok(!!hdc, "Got unexpected hdc %p.\n", hdc);
- todo_wine {
hr = ID3DXFont_GetGlyphData(font, 0, NULL, &blackbox, &cellinc);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = ID3DXFont_GetGlyphData(font, 0, &texture, NULL, &cellinc);
- if(SUCCEEDED(hr)) check_release((IUnknown *)texture, 1);
+ check_release((IUnknown *)texture, 1);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = ID3DXFont_GetGlyphData(font, 0, &texture, &blackbox, NULL);
- if(SUCCEEDED(hr)) check_release((IUnknown *)texture, 1);
+ check_release((IUnknown *)texture, 1);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- }
+
hr = ID3DXFont_PreloadCharacters(font, 'b', 'a');
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = ID3DXFont_PreloadGlyphs(font, 1, 0);
@@ -567,12 +566,10 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
ok(count != GDI_ERROR, "Got unexpected count %u.\n", count);
hr = ID3DXFont_GetGlyphData(font, glyph, &texture, &blackbox,
&cellinc);
- todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- if (FAILED(hr))
- continue;
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
levels = IDirect3DTexture9_GetLevelCount(texture);
- ok(levels == 5, "Character %c: got unexpected levels %u.\n", c,
levels);
+ todo_wine ok(levels == 5, "Character %c: got unexpected levels %u.\n",
c, levels);
hr = IDirect3DTexture9_GetLevelDesc(texture, 0, &surf_desc);
ok(hr == D3D_OK, "Character %c: got unexpected hr %#x.\n", c, hr);
ok(surf_desc.Format == D3DFMT_A8R8G8B8, "Character %c: got unexpected format
%#x.\n", c, surf_desc.Format);
@@ -587,9 +584,9 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
ret = ID3DXFont_GetTextMetricsW(font, &tm);
ok(ret, "Got unexpected ret %#x.\n", ret);
- ok(blackbox.right - blackbox.left == glyph_metrics.gmBlackBoxX + 2,
"Character %c: got %d, expected %d.\n",
+ todo_wine ok(blackbox.right - blackbox.left == glyph_metrics.gmBlackBoxX + 2,
"Character %c: got %d, expected %d.\n",
c, blackbox.right - blackbox.left, glyph_metrics.gmBlackBoxX + 2);
- ok(blackbox.bottom - blackbox.top == glyph_metrics.gmBlackBoxY + 2,
"Character %c: got %d, expected %d.\n",
+ todo_wine ok(blackbox.bottom - blackbox.top == glyph_metrics.gmBlackBoxY + 2,
"Character %c: got %d, expected %d.\n",
c, blackbox.bottom - blackbox.top, glyph_metrics.gmBlackBoxY + 2);
ok(cellinc.x == glyph_metrics.gmptGlyphOrigin.x - 1, "Character %c: got %d,
expected %d.\n",
c, cellinc.x, glyph_metrics.gmptGlyphOrigin.x - 1);
@@ -611,8 +608,8 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
{
texture = (IDirect3DTexture9 *)0xdeadbeef;
hr = ID3DXFont_GetGlyphData(font, glyph, &texture, &blackbox,
&cellinc);
- todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- todo_wine ok(!texture, "Got unexpected texture %p.\n", texture);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+ ok(!texture, "Got unexpected texture %p.\n", texture);
}
check_release((IUnknown *)font, 0);
@@ -631,23 +628,21 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
ok(count != GDI_ERROR, "Test %u: got unexpected count %u.\n", i,
count);
hr = ID3DXFont_GetGlyphData(font, glyph, &texture, NULL, NULL);
- todo_wine ok(hr == D3D_OK, "Test %u: got unexpected hr %#x.\n", i,
hr);
- if(SUCCEEDED(hr)) {
- DWORD levels;
- D3DSURFACE_DESC desc;
-
- levels = IDirect3DTexture9_GetLevelCount(texture);
- ok(levels == tests[i].expected_levels, "Test %u: got unexpected levels
%u.\n", i, levels);
- hr = IDirect3DTexture9_GetLevelDesc(texture, 0, &desc);
- ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- ok(desc.Format == D3DFMT_A8R8G8B8, "Test %u: got unexpected format
%#x.\n", i, desc.Format);
- ok(desc.Usage == 0, "Test %u: got unexpected usage %#x.\n", i,
desc.Usage);
- ok(desc.Width == tests[i].expected_size, "Test %u: got unexpected width
%u.\n", i, desc.Width);
- ok(desc.Height == tests[i].expected_size, "Test %u: got unexpected
height %u.\n", i, desc.Height);
- ok(desc.Pool == D3DPOOL_MANAGED, "Test %u: got unexpected pool
%u.\n", i, desc.Pool);
-
- IDirect3DTexture9_Release(texture);
- }
+ ok(hr == D3D_OK, "Test %u: got unexpected hr %#x.\n", i, hr);
+
+ levels = IDirect3DTexture9_GetLevelCount(texture);
+ todo_wine_if(tests[i].expected_levels < 9)
+ ok(levels == tests[i].expected_levels, "Test %u: got unexpected levels
%u.\n", i, levels);
+
+ hr = IDirect3DTexture9_GetLevelDesc(texture, 0, &surf_desc);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+ ok(surf_desc.Format == D3DFMT_A8R8G8B8, "Test %u: got unexpected format
%#x.\n", i, surf_desc.Format);
+ ok(surf_desc.Usage == 0, "Test %u: got unexpected usage %#x.\n", i,
surf_desc.Usage);
+ ok(surf_desc.Width == tests[i].expected_size, "Test %u: got unexpected width
%u.\n", i, surf_desc.Width);
+ ok(surf_desc.Height == tests[i].expected_size, "Test %u: got unexpected
height %u.\n", i, surf_desc.Height);
+ ok(surf_desc.Pool == D3DPOOL_MANAGED, "Test %u: got unexpected pool
%u.\n", i, surf_desc.Pool);
+
+ IDirect3DTexture9_Release(texture);
/* ID3DXFontImpl_DrawText */
D3DXCreateSprite(device, &sprite);
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 94741b46435..3948abeff75 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: ac5687463700b070fc1eecca67c4a46ec15127fa}
+tags: {wine: e9ea8a05e54f1c950e5c15979d1393ad013402b1}