Nikolay Sivov : comctl32: Improve DrawShadowText().

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 25 09:47:12 CDT 2016


Module: wine
Branch: master
Commit: 2771fd9758b71b64a43773f22f09c5ec304cc751
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2771fd9758b71b64a43773f22f09c5ec304cc751

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Apr 24 16:24:35 2016 +0300

comctl32: Improve DrawShadowText().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/commctrl.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c
index c12a214..2a4cd42 100644
--- a/dlls/comctl32/commctrl.c
+++ b/dlls/comctl32/commctrl.c
@@ -1592,12 +1592,33 @@ LRESULT WINAPI SetPathWordBreakProc(HWND hwnd, BOOL bSet)
  *
  * Draw text with shadow.
  */
-int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *rect, DWORD dwFlags,
-                          COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
+int WINAPI DrawShadowText(HDC hdc, LPCWSTR text, UINT length, RECT *rect, DWORD flags,
+                          COLORREF crText, COLORREF crShadow, int offset_x, int offset_y)
 {
-    FIXME("(%p, %s, %d, %p, %d, 0x%08x, 0x%08x, %d, %d): stub\n", hdc, debugstr_w(pszText), cch, rect, dwFlags,
-                                                                  crText, crShadow, ixOffset, iyOffset);
-    return DrawTextW(hdc, pszText, cch, rect, DT_LEFT);
+    int bkmode, ret;
+    COLORREF clr;
+    RECT r;
+
+    FIXME("(%p, %s, %d, %p, 0x%08x, 0x%08x, 0x%08x, %d, %d): semi-stub\n", hdc, debugstr_w(text),
+        length, rect, flags, crText, crShadow, offset_x, offset_y);
+
+    bkmode = SetBkMode(hdc, TRANSPARENT);
+    clr = SetTextColor(hdc, crShadow);
+
+    /* FIXME: for shadow we need to render normally, blur it, and blend with current background. */
+    r = *rect;
+    OffsetRect(&r, 1, 1);
+    DrawTextW(hdc, text, length, &r, flags);
+
+    SetTextColor(hdc, crText);
+
+    /* with text color on top of a shadow */
+    ret = DrawTextW(hdc, text, length, rect, flags);
+
+    SetTextColor(hdc, clr);
+    SetBkMode(hdc, bkmode);
+
+    return ret;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list