Huw Davies : riched20: Use ME_Paragraph and ME_Run ptrs in GetCursorCoordinates().
Alexandre Julliard
julliard at winehq.org
Mon Oct 12 15:20:50 CDT 2020
Module: wine
Branch: master
Commit: f648eff16261a569552e1199fa4eb3e9f4f044c9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f648eff16261a569552e1199fa4eb3e9f4f044c9
Author: Huw Davies <huw at codeweavers.com>
Date: Mon Oct 12 13:09:08 2020 +0100
riched20: Use ME_Paragraph and ME_Run ptrs in GetCursorCoordinates().
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/riched20/caret.c | 39 ++++++++++++++-------------------------
1 file changed, 14 insertions(+), 25 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index e9ea64ed1b..bd533f91ba 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -222,49 +222,38 @@ void ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor,
int *x, int *y, int *height)
{
ME_DisplayItem *row;
- ME_DisplayItem *run = pCursor->pRun;
- ME_DisplayItem *para = pCursor->pPara;
- ME_DisplayItem *pSizeRun = run;
+ ME_Run *run = &pCursor->pRun->member.run;
+ ME_Paragraph *para = &pCursor->pPara->member.para;
+ ME_Run *size_run = run, *prev;
ME_Context c;
int run_x;
assert(height && x && y);
- assert(~para->member.para.nFlags & MEPF_REWRAP);
- assert(run && run->type == diRun);
- assert(para && para->type == diParagraph);
+ assert(~para->nFlags & MEPF_REWRAP);
- row = ME_FindItemBack(run, diStartRowOrParagraph);
+ row = ME_FindItemBack( run_get_di( run ), diStartRowOrParagraph );
assert(row && row->type == diStartRow);
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
- if (!pCursor->nOffset)
- {
- ME_DisplayItem *prev = ME_FindItemBack(run, diRunOrParagraph);
- assert(prev);
- if (prev->type == diRun)
- pSizeRun = prev;
- }
+ if (!pCursor->nOffset && (prev = run_prev( run ))) size_run = prev;
+
if (editor->bCaretAtEnd && !pCursor->nOffset &&
- run == ME_FindItemFwd(row, diRun))
+ run == &ME_FindItemFwd( row, diRun )->member.run)
{
ME_DisplayItem *tmp = ME_FindItemBack(row, diRunOrParagraph);
- assert(tmp);
if (tmp->type == diRun)
{
row = ME_FindItemBack(tmp, diStartRow);
- pSizeRun = run = tmp;
- assert(run);
- assert(run->type == diRun);
+ size_run = run = &tmp->member.run;
}
}
- run_x = ME_PointFromCharContext( &c, &run->member.run, pCursor->nOffset, TRUE );
+ run_x = ME_PointFromCharContext( &c, run, pCursor->nOffset, TRUE );
- *height = pSizeRun->member.run.nAscent + pSizeRun->member.run.nDescent;
- *x = c.rcView.left + run->member.run.pt.x + run_x - editor->horz_si.nPos;
- *y = c.rcView.top + para->member.para.pt.y + row->member.row.nBaseline
- + run->member.run.pt.y - pSizeRun->member.run.nAscent
- - editor->vert_si.nPos;
+ *height = size_run->nAscent + size_run->nDescent;
+ *x = c.rcView.left + run->pt.x + run_x - editor->horz_si.nPos;
+ *y = c.rcView.top + para->pt.y + row->member.row.nBaseline
+ + run->pt.y - size_run->nAscent - editor->vert_si.nPos;
ME_DestroyContext(&c);
return;
}
More information about the wine-cvs
mailing list