richedit: Move init code after some sanity checks to avoid unneeded computations.
This commit is contained in:
parent
d48905cf21
commit
4cecb5dc70
|
@ -267,7 +267,7 @@ static void ME_DrawGraphics(ME_Context *c, int x, int y, ME_Run *run,
|
||||||
static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Paragraph *para)
|
static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Paragraph *para)
|
||||||
{
|
{
|
||||||
ME_Run *run = &rundi->member.run;
|
ME_Run *run = &rundi->member.run;
|
||||||
ME_DisplayItem *start = ME_FindItemBack(rundi, diStartRow);
|
ME_DisplayItem *start;
|
||||||
int runofs = run->nCharOfs+para->nCharOfs;
|
int runofs = run->nCharOfs+para->nCharOfs;
|
||||||
int nSelFrom, nSelTo;
|
int nSelFrom, nSelTo;
|
||||||
const WCHAR wszSpace[] = {' ', 0};
|
const WCHAR wszSpace[] = {' ', 0};
|
||||||
|
@ -275,6 +275,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa
|
||||||
if (run->nFlags & MERF_HIDDEN)
|
if (run->nFlags & MERF_HIDDEN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
start = ME_FindItemBack(rundi, diStartRow);
|
||||||
ME_GetSelection(c->editor, &nSelFrom, &nSelTo);
|
ME_GetSelection(c->editor, &nSelFrom, &nSelTo);
|
||||||
|
|
||||||
/* Draw selected end-of-paragraph mark */
|
/* Draw selected end-of-paragraph mark */
|
||||||
|
|
|
@ -606,7 +606,7 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run)
|
||||||
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset)
|
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset)
|
||||||
{
|
{
|
||||||
SIZE size;
|
SIZE size;
|
||||||
HDC hDC = GetDC(editor->hWnd);
|
HDC hDC;
|
||||||
HGDIOBJ hOldFont;
|
HGDIOBJ hOldFont;
|
||||||
ME_String *strRunText;
|
ME_String *strRunText;
|
||||||
/* This could point to either the run's real text, or it's masked form in a password control */
|
/* This could point to either the run's real text, or it's masked form in a password control */
|
||||||
|
@ -623,6 +623,7 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset)
|
||||||
else
|
else
|
||||||
strRunText = pRun->strText;
|
strRunText = pRun->strText;
|
||||||
|
|
||||||
|
hDC = GetDC(editor->hWnd);
|
||||||
hOldFont = ME_SelectStyleFont(editor, hDC, pRun->style);
|
hOldFont = ME_SelectStyleFont(editor, hDC, pRun->style);
|
||||||
GetTextExtentPoint32W(hDC, strRunText->szData, nOffset, &size);
|
GetTextExtentPoint32W(hDC, strRunText->szData, nOffset, &size);
|
||||||
ME_UnselectStyleFont(editor, hDC, pRun->style, hOldFont);
|
ME_UnselectStyleFont(editor, hDC, pRun->style, hOldFont);
|
||||||
|
|
|
@ -341,7 +341,7 @@ static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp);
|
||||||
static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD beginofs) {
|
static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD beginofs) {
|
||||||
ME_DisplayItem *p;
|
ME_DisplayItem *p;
|
||||||
ME_WrapContext wc;
|
ME_WrapContext wc;
|
||||||
int dpi = GetDeviceCaps(c->hDC, LOGPIXELSX);
|
int dpi;
|
||||||
int border = 0;
|
int border = 0;
|
||||||
int linespace = 0;
|
int linespace = 0;
|
||||||
|
|
||||||
|
@ -351,6 +351,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino
|
||||||
}
|
}
|
||||||
ME_PrepareParagraphForWrapping(c, tp);
|
ME_PrepareParagraphForWrapping(c, tp);
|
||||||
|
|
||||||
|
dpi = GetDeviceCaps(c->hDC, LOGPIXELSX);
|
||||||
wc.context = c;
|
wc.context = c;
|
||||||
/* wc.para_style = tp->member.para.style; */
|
/* wc.para_style = tp->member.para.style; */
|
||||||
wc.style = NULL;
|
wc.style = NULL;
|
||||||
|
|
Loading…
Reference in New Issue