Huw Davies : riched20: Move the password string hack to just before it' s used.
Alexandre Julliard
julliard at winehq.org
Fri Feb 15 11:19:17 CST 2013
Module: wine
Branch: master
Commit: 635614b5ea9881bb9b922549b3cfb5f9bceee02c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=635614b5ea9881bb9b922549b3cfb5f9bceee02c
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Feb 15 16:13:40 2013 +0000
riched20: Move the password string hack to just before it's used.
---
dlls/riched20/paint.c | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 9937ec7..0ab4e2b 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -314,11 +314,19 @@ static void get_selection_rect( ME_Context *c, ME_Run *run, int from, int to, in
}
-static void draw_text( ME_Context *c, ME_Run *run, int x, int y, const WCHAR *text, BOOL selected, RECT *sel_rect )
+static void draw_text( ME_Context *c, ME_Run *run, int x, int y, BOOL selected, RECT *sel_rect )
{
COLORREF text_color = get_text_color( c, run->style, selected );
COLORREF back_color = selected ? ITextHost_TxGetSysColor( c->editor->texthost, COLOR_HIGHLIGHT ) : 0;
COLORREF old_text, old_back;
+ const WCHAR *text = get_text( run, 0 );
+ ME_String *masked = NULL;
+
+ if (c->editor->cPasswordMask)
+ {
+ masked = ME_MakeStringR( c->editor->cPasswordMask, run->len );
+ text = masked->szData;
+ }
old_text = SetTextColor( c->hDC, text_color );
if (selected) old_back = SetBkColor( c->hDC, back_color );
@@ -330,11 +338,12 @@ static void draw_text( ME_Context *c, ME_Run *run, int x, int y, const WCHAR *te
draw_underline( c, run, x, y, text_color );
+ ME_DestroyString( masked );
return;
}
-static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWSTR szText,
+static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y,
int nSelFrom, int nSelTo, int ymin, int cy)
{
HDC hDC = c->hDC;
@@ -373,12 +382,12 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS
hOldFont = ME_SelectStyleFont( c, run->style );
if (sel_rgn) ExtSelectClipRgn( hDC, sel_rgn, RGN_DIFF );
- draw_text( c, run, x, y - yOffset, szText, FALSE, NULL );
+ draw_text( c, run, x, y - yOffset, FALSE, NULL );
if (sel_rgn)
{
ExtSelectClipRgn( hDC, clip, RGN_COPY );
ExtSelectClipRgn( hDC, sel_rgn, RGN_AND );
- draw_text( c, run, x, y - yOffset, szText, TRUE, &sel_rect );
+ draw_text( c, run, x, y - yOffset, TRUE, &sel_rect );
ExtSelectClipRgn( hDC, clip, RGN_COPY );
if (clip) DeleteObject( clip );
DeleteObject( sel_rgn );
@@ -439,20 +448,9 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa
ME_DrawOLE(c, x, y, run, para, (runofs >= nSelFrom) && (runofs < nSelTo));
else
{
- if (c->editor->cPasswordMask)
- {
- ME_String *szMasked = ME_MakeStringR(c->editor->cPasswordMask, run->len);
- ME_DrawTextWithStyle(c, run, x, y,
- szMasked->szData, nSelFrom - runofs, nSelTo - runofs,
- c->pt.y + para->pt.y + start->member.row.pt.y,
- start->member.row.nHeight);
- ME_DestroyString(szMasked);
- }
- else
- ME_DrawTextWithStyle(c, run, x, y,
- get_text( run, 0 ), nSelFrom - runofs, nSelTo - runofs,
- c->pt.y + para->pt.y + start->member.row.pt.y,
- start->member.row.nHeight);
+ ME_DrawTextWithStyle(c, run, x, y, nSelFrom - runofs, nSelTo - runofs,
+ c->pt.y + para->pt.y + start->member.row.pt.y,
+ start->member.row.nHeight);
}
}
More information about the wine-cvs
mailing list