Ulrich Czekalla : user32: Don' t scale draw text margin params by character width units.
Alexandre Julliard
julliard at winehq.org
Tue Feb 3 09:13:07 CST 2009
Module: wine
Branch: master
Commit: 209820c42864579a128e54913cd6cbd3c046625d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=209820c42864579a128e54913cd6cbd3c046625d
Author: Ulrich Czekalla <ulrich.czekalla at utoronto.ca>
Date: Mon Feb 2 13:47:00 2009 -0500
user32: Don't scale draw text margin params by character width units.
Values passed in DRAWTEXTPARAMS are already in average character width
units.
---
dlls/user32/tests/text.c | 17 +++++++++++++++++
dlls/user32/text.c | 4 ++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/text.c b/dlls/user32/tests/text.c
index fc554ae..47f5274 100644
--- a/dlls/user32/tests/text.c
+++ b/dlls/user32/tests/text.c
@@ -316,6 +316,23 @@ static void test_DrawTextCalcRect(void)
ok(textheight==0,"Got textheight from DrawTextExA\n");
ok(dtp.uiLengthDrawn==1337, "invalid dtp.uiLengthDrawn = %i\n",dtp.uiLengthDrawn);
+ /* Margin calculations */
+ dtp.cbSize = sizeof(dtp);
+ dtp.iLeftMargin = 0;
+ dtp.iRightMargin = 0;
+ SetRect( &rect, 0, 0, 0, 0);
+ DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
+ textlen = rect.right; /* Width without margin */
+ dtp.iLeftMargin = 8;
+ SetRect( &rect, 0, 0, 0, 0);
+ DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
+ ok(rect.right==dtp.iLeftMargin+textlen ,"Incorrect left margin calculated rc(%d,%d)\n", rect.left, rect.right);
+ dtp.iLeftMargin = 0;
+ dtp.iRightMargin = 8;
+ SetRect( &rect, 0, 0, 0, 0);
+ DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
+ ok(rect.right==dtp.iRightMargin+textlen ,"Incorrect right margin calculated rc(%d,%d)\n", rect.left, rect.right);
+
/* Wide char versions */
SetRect( &rect, 10,10, 100, 100);
SetLastError( 0);
diff --git a/dlls/user32/text.c b/dlls/user32/text.c
index 2b864a2..b8aad0b 100644
--- a/dlls/user32/text.c
+++ b/dlls/user32/text.c
@@ -900,8 +900,8 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
if (dtp)
{
- lmargin = dtp->iLeftMargin * tm.tmAveCharWidth;
- rmargin = dtp->iRightMargin * tm.tmAveCharWidth;
+ lmargin = dtp->iLeftMargin;
+ rmargin = dtp->iRightMargin;
if (!(flags & (DT_CENTER | DT_RIGHT)))
x += lmargin;
dtp->uiLengthDrawn = 0; /* This param RECEIVES number of chars processed */
More information about the wine-cvs
mailing list