Sven Baars : d3dx9: Handle clipping in ID3DXFont_DrawText.
Alexandre Julliard
julliard at winehq.org
Fri Mar 6 16:38:40 CST 2020
Module: wine
Branch: master
Commit: 6da3e904a1efc921030fdbe34070b981bf57524c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6da3e904a1efc921030fdbe34070b981bf57524c
Author: Sven Baars <sbaars at codeweavers.com>
Date: Thu Mar 5 22:39:58 2020 +0100
d3dx9: Handle clipping in ID3DXFont_DrawText.
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 | 5 +++++
dlls/d3dx9_36/tests/core.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index 71cfddb0d4..9e9cb658db 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -559,6 +559,9 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
if (!count)
return 0;
+ if (format & DT_CALCRECT)
+ format |= DT_NOCLIP;
+
if (!rect)
{
y = ID3DXFont_DrawTextW(iface, NULL, string, count, &textrect, format | DT_CALCRECT, 0);
@@ -637,6 +640,8 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
heap_free(results.lpGlyphs);
}
y += lh;
+ if (!(DT_NOCLIP & format) && (y > textrect.bottom))
+ break;
}
ret = y - textrect.top;
diff --git a/dlls/d3dx9_36/tests/core.c b/dlls/d3dx9_36/tests/core.c
index c6f5beff43..c79f5c1f72 100644
--- a/dlls/d3dx9_36/tests/core.c
+++ b/dlls/d3dx9_36/tests/core.c
@@ -780,7 +780,7 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
todo_wine ok(height == 36, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, 0, 0xff00ff);
- todo_wine ok(height == 48, "Got unexpected height %d.\n", height);
+ ok(height == 48, "Got unexpected height %d.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, DT_NOCLIP, 0xff00ff);
ok(height == 72, "Got unexpected height %d.\n", height);
More information about the wine-cvs
mailing list