https://git.reactos.org/?p=reactos.git;a=commitdiff;h=54240ccee0282eed81395…
commit 54240ccee0282eed81395748c498adfd19081033
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Jan 4 02:11:30 2020 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Wed Feb 26 18:19:18 2020 +0100
[WINESYNC]d3dx9_36: Fix horizontal centering in ID3DXFont_DrawText.
Fix remaining text issues in Air Strike.
Should fix text placement in Stronghold Kingdoms.
wine-staging patch by Christian Costa <titan.costa(a)gmail.com>
---
dll/directx/wine/d3dx9_36/font.c | 7 +++++++
...Fix_horizontal_centering_in_ID3DXFont_DrawText.diff | 18 ++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c
index 2e2f6964c45..e8689bb864f 100644
--- a/dll/directx/wine/d3dx9_36/font.c
+++ b/dll/directx/wine/d3dx9_36/font.c
@@ -253,6 +253,13 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface,
ID3DXSprite *sprite,
return height;
}
+ if (format & DT_CENTER)
+ {
+ UINT new_width = calc_rect.right - calc_rect.left;
+ calc_rect.left = (rect->right + rect->left - new_width) / 2;
+ calc_rect.right = calc_rect.left + new_width;
+ }
+
if (height && (calc_rect.left < calc_rect.right))
{
D3DLOCKED_RECT locked_rect;
diff --git
a/sdk/tools/winesync/d3dx9_staging/0016-d3dx9_36__Fix_horizontal_centering_in_ID3DXFont_DrawText.diff
b/sdk/tools/winesync/d3dx9_staging/0016-d3dx9_36__Fix_horizontal_centering_in_ID3DXFont_DrawText.diff
new file mode 100644
index 00000000000..4f34de4c6e6
--- /dev/null
+++
b/sdk/tools/winesync/d3dx9_staging/0016-d3dx9_36__Fix_horizontal_centering_in_ID3DXFont_DrawText.diff
@@ -0,0 +1,18 @@
+diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c
+index 2e2f696..e8689bb 100644
+--- a/dll/directx/wine/d3dx9_36/font.c
++++ b/dll/directx/wine/d3dx9_36/font.c
+@@ -253,6 +253,13 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface,
ID3DXSprite *sprite,
+ return height;
+ }
+
++ if (format & DT_CENTER)
++ {
++ UINT new_width = calc_rect.right - calc_rect.left;
++ calc_rect.left = (rect->right + rect->left - new_width) / 2;
++ calc_rect.right = calc_rect.left + new_width;
++ }
++
+ if (height && (calc_rect.left < calc_rect.right))
+ {
+ D3DLOCKED_RECT locked_rect;