Added patch to fix handling of invert_y in DrawTextExW.

This commit is contained in:
Sebastian Lackner 2014-11-13 06:49:12 +01:00
parent 75c5402c30
commit 82d94a776d
5 changed files with 109 additions and 1 deletions

View File

@ -39,7 +39,7 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [18]:**
**Bugfixes and features included in the next upcoming release [19]:**
* Add stub for NtSetLdtEntries/ZwSetLdtEntries ([Wine Bug #26268](https://bugs.winehq.org/show_bug.cgi?id=26268))
* Add stubs for vectored continue handler ([Wine Bug #30572](https://bugs.winehq.org/show_bug.cgi?id=30572))
@ -53,6 +53,7 @@ Included bug fixes and improvements
* FairplayKD.sys needs KeSetSystemAffinityThread ([Wine Bug #36822](https://bugs.winehq.org/show_bug.cgi?id=36822))
* Fix crash of Trine Demo on start ([Wine Bug #19231](https://bugs.winehq.org/show_bug.cgi?id=19231))
* Fix crash of winedevice when relocation entry crosses page boundary ([Wine Bug #28254](https://bugs.winehq.org/show_bug.cgi?id=28254))
* Fix handling of invert_y in DrawTextExW ([Wine Bug #22109](https://bugs.winehq.org/show_bug.cgi?id=22109))
* Fix texture corruption in CSI: Fatal Conspiracy ([Wine Bug #33768](https://bugs.winehq.org/show_bug.cgi?id=33768))
* MSVCRT crashes when NULL is passed as string to atof or strtod ([Wine Bug #32550](https://bugs.winehq.org/show_bug.cgi?id=32550))
* Return correct values for GetThreadTimes function ([Wine Bug #20230](https://bugs.winehq.org/show_bug.cgi?id=20230))

1
debian/changelog vendored
View File

@ -21,6 +21,7 @@ wine-compholio (1.7.31) UNRELEASED; urgency=low
* Added patch to return more context attributes in schan_InitializeSecurityContextW.
* Added patch to avoid crashing when broken app tries to release surface although refcount is zero.
* Added patch to avoid sending window messages in FindWindowExW.
* Added patch to fix handling of invert_y in DrawTextExW.
* Removed patch for iphlpapi stub functions (accepted upstream).
* Removed patches for FindFirstFileExW (accepted upstream).
* Removed patches for TLB dependencies lookup in resources (accepted upstream).

View File

@ -97,6 +97,7 @@ PATCHLIST := \
shlwapi-PathIsDirectoryEmptyW.ok \
shlwapi-UrlCombine.ok \
user32-Dialog_Paint_Event.ok \
user32-DrawTextExW.ok \
user32-FindWindowEx.ok \
user32-GetSystemMetrics.ok \
user32-GetTipText.ok \
@ -1666,6 +1667,24 @@ user32-Dialog_Paint_Event.ok:
echo '+ { "user32-Dialog_Paint_Event", "Sebastian Lackner", "Call UpdateWindow during DIALOG_CreateIndirect." },'; \
) > user32-Dialog_Paint_Event.ok
# Patchset user32-DrawTextExW
# |
# | Included patches:
# | * Fix handling of invert_y in DrawTextExW. [by Sebastian Lackner]
# |
# | This patchset fixes the following Wine bugs:
# | * [#22109] Fix handling of invert_y in DrawTextExW
# |
# | Modified files:
# | * dlls/user32/text.c
# |
.INTERMEDIATE: user32-DrawTextExW.ok
user32-DrawTextExW.ok:
$(call APPLY_FILE,user32-DrawTextExW/0001-user32-Fix-handling-of-invert_y-in-DrawTextExW.patch)
@( \
echo '+ { "user32-DrawTextExW", "Sebastian Lackner", "Fix handling of invert_y in DrawTextExW." },'; \
) > user32-DrawTextExW.ok
# Patchset user32-FindWindowEx
# |
# | Included patches:

View File

@ -0,0 +1,83 @@
From 984661d3ad7f1a78cc5b69f81a45b949781ce791 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 13 Nov 2014 06:43:43 +0100
Subject: user32: Fix handling of invert_y in DrawTextExW.
---
dlls/user32/text.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/text.c b/dlls/user32/text.c
index 66a35d2..2aa127a 100644
--- a/dlls/user32/text.c
+++ b/dlls/user32/text.c
@@ -911,6 +911,15 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
if (dtp && dtp->cbSize != sizeof(DRAWTEXTPARAMS))
return 0;
+ if (GetGraphicsMode(hdc) == GM_COMPATIBLE)
+ {
+ SIZE window_ext, viewport_ext;
+ GetWindowExtEx(hdc, &window_ext);
+ GetViewportExtEx(hdc, &viewport_ext);
+ if ((window_ext.cy > 0) != (viewport_ext.cy > 0))
+ invert_y = TRUE;
+ }
+
if (count == -1)
{
count = strlenW(str);
@@ -920,7 +929,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
{
rect->right = rect->left;
if( flags & DT_SINGLELINE)
- rect->bottom = rect->top + lh;
+ rect->bottom = rect->top + (invert_y ? -lh : lh);
else
rect->bottom = rect->top;
}
@@ -928,15 +937,6 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
}
}
- if (GetGraphicsMode(hdc) == GM_COMPATIBLE)
- {
- SIZE window_ext, viewport_ext;
- GetWindowExtEx(hdc, &window_ext);
- GetViewportExtEx(hdc, &viewport_ext);
- if ((window_ext.cy > 0) != (viewport_ext.cy > 0))
- invert_y = TRUE;
- }
-
if (dtp)
{
lmargin = dtp->iLeftMargin;
@@ -983,9 +983,10 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
if (flags & DT_SINGLELINE)
{
- if (flags & DT_VCENTER) y = rect->top +
- (rect->bottom - rect->top) / 2 - size.cy / 2;
- else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
+ if (flags & DT_VCENTER)
+ y = rect->top + (rect->bottom - rect->top) / 2 + (invert_y ? (size.cy / 2) : (-size.cy / 2));
+ else if (flags & DT_BOTTOM)
+ y = rect->bottom + (invert_y ? 0 : -size.cy);
}
if (!(flags & DT_CALCRECT))
@@ -1050,10 +1051,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
else if (size.cx > max_width)
max_width = size.cx;
- if (invert_y)
- y -= lh;
- else
- y += lh;
+ y += invert_y ? -lh : lh;
if (dtp)
dtp->uiLengthDrawn += len;
}
--
2.1.3

View File

@ -0,0 +1,4 @@
Author: Sebastian Lackner
Subject: Fix handling of invert_y in DrawTextExW.
Revision: 1
Fixes: [22109] Fix handling of invert_y in DrawTextExW