d3dx9_36-DrawText: Added patch to fix horizontal centering.

This commit is contained in:
Sebastian Lackner 2015-01-04 19:32:27 +01:00
parent 1ba1541771
commit 205001dab8
2 changed files with 34 additions and 0 deletions

View File

@ -409,8 +409,10 @@ d3dx9_36-DXTn.ok: wined3d-DXTn.ok
.INTERMEDIATE: d3dx9_36-DrawText.ok
d3dx9_36-DrawText.ok:
$(call APPLY_FILE,d3dx9_36-DrawText/0001-d3dx9_36-Implement-ID3DXFontImpl_DrawText.patch)
$(call APPLY_FILE,d3dx9_36-DrawText/0002-d3dx9_36-Fix-horizontal-centering-in-ID3DXFont_DrawT.patch)
@( \
echo '+ { "Christian Costa", "d3dx9_36: Implement ID3DXFontImpl_DrawText.", 1 },'; \
echo '+ { "Christian Costa", "d3dx9_36: Fix horizontal centering in ID3DXFont_DrawText.", 1 },'; \
) > d3dx9_36-DrawText.ok
# Patchset d3dx9_36-Filter_Warnings

View File

@ -0,0 +1,32 @@
From 93b91dc6b0ccaf6c9babab7adb218454df93b750 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sun, 4 Jan 2015 18:43:42 +0100
Subject: d3dx9_36: Fix horizontal centering in ID3DXFont_DrawText.
Fix remaining text issues in Air Strike.
Should fix text placement in Stronghold Kingdoms.
---
dlls/d3dx9_36/font.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index 368c784..fa52859 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -254,6 +254,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;
--
2.2.1