[WINESYNC] d3dx9: Handle clipping in ID3DXFont_DrawText.

Signed-off-by: Sven Baars <sbaars@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 6da3e904a1efc921030fdbe34070b981bf57524c by Sven Baars <sbaars@codeweavers.com>
This commit is contained in:
winesync 2020-09-21 23:03:28 +02:00 committed by Jérôme Gardou
parent 9363eac228
commit 818c9f88b0
3 changed files with 7 additions and 2 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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}