On Tue, Mar 10, 2020 at 11:38 AM Sven Baars sbaars@codeweavers.com wrote:
Signed-off-by: Sven Baars sbaars@codeweavers.com
dlls/d3dx9_36/font.c | 30 ++++++++++++++++++++++++------ dlls/d3dx9_36/tests/core.c | 14 ++++++++++++-- 2 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c index 3645903367..bd81a7044b 100644 --- a/dlls/d3dx9_36/font.c +++ b/dlls/d3dx9_36/font.c @@ -603,12 +603,12 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, const WCHAR *string, INT count, RECT *rect, DWORD format, D3DCOLOR color) { struct d3dx_font *font = impl_from_ID3DXFont(iface);
- RECT calcrect, textrect = {0}; ID3DXSprite *target = sprite;
- WCHAR *line;
- RECT textrect = {0}; int lh, x, y, width; int max_width = 0; int ret = 0;
WCHAR *line; SIZE size;
TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x.\n",
@@ -641,9 +641,27 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, textrect = *rect; }
- x = textrect.left;
- y = textrect.top;
- width = textrect.right - textrect.left;
- calcrect = textrect;
- if (format & (DT_VCENTER | DT_BOTTOM))
- {
y = ID3DXFont_DrawTextW(iface, NULL, string, count, &calcrect,
format & ~DT_BOTTOM & ~DT_VCENTER, 0);
Was the idea here to add DT_CALCRECT to the format flags, by any chance? As it is now I think you end up drawing the text twice, once top-aligned and once with the "correct" vertical alignment flags. FWIW it doesn't look to me like it's necessary to do a recursive call to handle those flags.
Nitpick: indentation.