d3dx9: Implement clipping of glyphs in ID3DXFont_DrawText.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49546
Signed-off-by: Sven Baars <sbaars@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sven Baars 2020-11-17 15:33:31 +01:00 committed by Alexandre Julliard
parent 2481e617bb
commit 84cbf6a49d
1 changed files with 15 additions and 1 deletions

View File

@ -583,7 +583,6 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, unsigned int *count,
}
else if (format & DT_SINGLELINE)
{
*dest_len = num_fit;
*count = 0;
}
}
@ -768,6 +767,21 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
pos.y = cell_inc.y + y;
pos.z = 0;
if (!(format & DT_NOCLIP))
{
if (pos.x > rect->right)
{
IDirect3DTexture9_Release(texture);
continue;
}
if (pos.x + black_box.right - black_box.left > rect->right)
black_box.right = black_box.left + rect->right - pos.x;
if (pos.y + black_box.bottom - black_box.top > rect->bottom)
black_box.bottom = black_box.top + rect->bottom - pos.y;
}
ID3DXSprite_Draw(target, texture, &black_box, NULL, &pos, color);
IDirect3DTexture9_Release(texture);
}