From 06bd04061437fc54095e93ec794856110b9e461a Mon Sep 17 00:00:00 2001 From: winesync Date: Tue, 5 Jan 2021 13:16:38 +0100 Subject: [PATCH] [WINESYNC] d3dx9: Implement clipping of glyphs in ID3DXFont_DrawText. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49546 Signed-off-by: Sven Baars Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard wine commit id 84cbf6a49dfe75b9fd497b2c3ef7e922857bb618 by Sven Baars --- dll/directx/wine/d3dx9_36/font.c | 16 +++++++++++++++- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c index 56cef145461..14300d32e5e 100644 --- a/dll/directx/wine/d3dx9_36/font.c +++ b/dll/directx/wine/d3dx9_36/font.c @@ -587,7 +587,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; } } @@ -772,6 +771,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); } diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 47c8d9b9134..9c4e5a95eb4 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -34,4 +34,4 @@ files: include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h tags: - wine: 2481e617bbd529a297266ad53b1afe1d96e9af89 + wine: 84cbf6a49dfe75b9fd497b2c3ef7e922857bb618