Zhiyi Zhang : user32: Respect margins more in DrawTextExW().

Alexandre Julliard julliard at winehq.org
Mon Jun 4 16:26:23 CDT 2018


Module: wine
Branch: master
Commit: 11e3cf091d8ec70a9d6004ac6a51d5c827d9ddff
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=11e3cf091d8ec70a9d6004ac6a51d5c827d9ddff

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Mon Jun  4 19:58:07 2018 +0800

user32: Respect margins more in DrawTextExW().

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/text.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/text.c b/dlls/user32/text.c
index 286c4f5..118dbeb 100644
--- a/dlls/user32/text.c
+++ b/dlls/user32/text.c
@@ -943,6 +943,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
     {
         lmargin = dtp->iLeftMargin;
         rmargin = dtp->iRightMargin;
+        width -= lmargin + rmargin;
         if (!(flags & (DT_CENTER | DT_RIGHT)))
             x += lmargin;
         dtp->uiLengthDrawn = 0;     /* This param RECEIVES number of chars processed */
@@ -978,9 +979,10 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
             last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom;
 	strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, retstr, tabwidth, &prefix_offset, &ellip);
 
-	if (flags & DT_CENTER) x = (rect->left + rect->right -
-				    size.cx) / 2;
-	else if (flags & DT_RIGHT) x = rect->right - size.cx;
+        if (flags & DT_CENTER)
+            x = (rect->left + lmargin + rect->right - rmargin - size.cx) / 2;
+        else if (flags & DT_RIGHT)
+            x = rect->right - size.cx - rmargin;
 
 	if (flags & DT_SINGLELINE)
 	{




More information about the wine-cvs mailing list