Commit 6da3e904 authored by Sven Baars's avatar Sven Baars Committed by Alexandre Julliard

d3dx9: Handle clipping in ID3DXFont_DrawText.

parent 330c3f91
...@@ -559,6 +559,9 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, ...@@ -559,6 +559,9 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
if (!count) if (!count)
return 0; return 0;
if (format & DT_CALCRECT)
format |= DT_NOCLIP;
if (!rect) if (!rect)
{ {
y = ID3DXFont_DrawTextW(iface, NULL, string, count, &textrect, format | DT_CALCRECT, 0); 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, ...@@ -637,6 +640,8 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
heap_free(results.lpGlyphs); heap_free(results.lpGlyphs);
} }
y += lh; y += lh;
if (!(DT_NOCLIP & format) && (y > textrect.bottom))
break;
} }
ret = y - textrect.top; ret = y - textrect.top;
......
...@@ -780,7 +780,7 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) ...@@ -780,7 +780,7 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
todo_wine ok(height == 36, "Got unexpected height %d.\n", height); 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); 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); 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); ok(height == 72, "Got unexpected height %d.\n", height);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment