From 818c9f88b09d8f936ab4879983db3e53d48372c2 Mon Sep 17 00:00:00 2001 From: winesync Date: Mon, 21 Sep 2020 23:03:28 +0200 Subject: [PATCH] [WINESYNC] d3dx9: Handle clipping in ID3DXFont_DrawText. Signed-off-by: Sven Baars Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard wine commit id 6da3e904a1efc921030fdbe34070b981bf57524c by Sven Baars --- dll/directx/wine/d3dx9_36/font.c | 5 +++++ modules/rostests/winetests/d3dx9_36/core.c | 2 +- sdk/tools/winesync/d3dx9.cfg | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c index d5907d15d94..8b122abd14f 100644 --- a/dll/directx/wine/d3dx9_36/font.c +++ b/dll/directx/wine/d3dx9_36/font.c @@ -563,6 +563,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); @@ -641,6 +644,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/modules/rostests/winetests/d3dx9_36/core.c b/modules/rostests/winetests/d3dx9_36/core.c index c6f5beff433..c79f5c1f728 100644 --- a/modules/rostests/winetests/d3dx9_36/core.c +++ b/modules/rostests/winetests/d3dx9_36/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); diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 6a43210e9fe..135d55d8c2f 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: 330c3f9108191feb6eb888384befb5cb54645233} +tags: {wine: 6da3e904a1efc921030fdbe34070b981bf57524c}