[WINESYNC] d3dx9_36: ID3DXFont_DrawText calc_rect can be null

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>

wine-staging patch by Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
This commit is contained in:
winesync 2020-02-05 22:13:54 +01:00 committed by Jérôme Gardou
parent f9c6d6e396
commit 58d515ea16
3 changed files with 90 additions and 2 deletions

View file

@ -235,7 +235,7 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
const WCHAR *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
{
struct d3dx_font *This = impl_from_ID3DXFont(iface);
RECT calc_rect = *rect;
RECT calc_rect;
INT height;
TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x\n",
@ -251,11 +251,15 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
while (count > 0 && !string[count-1])
count--;
if (rect)
calc_rect = *rect;
height = DrawTextW(This->hdc, string, count, &calc_rect, format | DT_CALCRECT);
if (format & DT_CALCRECT)
{
*rect = calc_rect;
if (rect)
*rect = calc_rect;
return height;
}