Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1f8cbe16
Commit
1f8cbe16
authored
May 09, 2012
by
Dylan Smith
Committed by
Alexandre Julliard
May 09, 2012
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Avoid scanning all text for paragraphs to invalidate.
parent
43c4c4b1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
34 deletions
+47
-34
editor.h
dlls/riched20/editor.h
+1
-1
paint.c
dlls/riched20/paint.c
+20
-18
wrap.c
dlls/riched20/wrap.c
+26
-15
No files found.
dlls/riched20/editor.h
View file @
1f8cbe16
...
...
@@ -187,7 +187,7 @@ void ME_DestroyContext(ME_Context *c) DECLSPEC_HIDDEN;
/* wrap.c */
BOOL
ME_WrapMarkedParagraphs
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
ME_InvalidateMarkedParagraphs
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
ME_InvalidateMarkedParagraphs
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
start_para
,
ME_DisplayItem
*
end_para
)
DECLSPEC_HIDDEN
;
void
ME_SendRequestResize
(
ME_TextEditor
*
editor
,
BOOL
force
)
DECLSPEC_HIDDEN
;
/* para.c */
...
...
dlls/riched20/paint.c
View file @
1f8cbe16
...
...
@@ -73,13 +73,7 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate)
/* Draw the paragraph if any of the paragraph is in the update region. */
if
(
ys
<
rcUpdate
->
bottom
&&
ye
>
rcUpdate
->
top
)
{
ME_DrawParagraph
(
&
c
,
item
);
/* Clear the repaint flag if the whole paragraph is in the
* update region. */
if
(
rcUpdate
->
top
<=
ys
&&
rcUpdate
->
bottom
>=
ye
)
item
->
member
.
para
.
nFlags
&=
~
MEPF_REPAINT
;
}
item
=
item
->
member
.
para
.
next_para
;
}
if
(
c
.
pt
.
y
+
editor
->
nTotalLength
<
c
.
rcView
.
bottom
)
...
...
@@ -1263,7 +1257,8 @@ void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor)
void
ME_InvalidateSelection
(
ME_TextEditor
*
editor
)
{
ME_DisplayItem
*
para1
,
*
para2
;
ME_DisplayItem
*
sel_start
,
*
sel_end
;
ME_DisplayItem
*
repaint_start
=
NULL
,
*
repaint_end
=
NULL
;
int
nStart
,
nEnd
;
int
len
=
ME_GetTextLength
(
editor
);
...
...
@@ -1273,32 +1268,39 @@ ME_InvalidateSelection(ME_TextEditor *editor)
if
(
nStart
==
nEnd
&&
editor
->
nLastSelStart
==
editor
->
nLastSelEnd
)
return
;
ME_WrapMarkedParagraphs
(
editor
);
ME_GetSelectionParas
(
editor
,
&
para1
,
&
para2
);
assert
(
para1
->
type
==
diParagraph
);
assert
(
para2
->
type
==
diParagraph
);
ME_GetSelectionParas
(
editor
,
&
sel_start
,
&
sel_end
);
assert
(
sel_start
->
type
==
diParagraph
);
assert
(
sel_end
->
type
==
diParagraph
);
/* last selection markers aren't always updated, which means
* they can point past the end of the document */
if
(
editor
->
nLastSelStart
>
len
||
editor
->
nLastSelEnd
>
len
)
{
ME_MarkForPainting
(
editor
,
ME_FindItemFwd
(
editor
->
pBuffer
->
pFirst
,
diParagraph
),
editor
->
pBuffer
->
pLast
);
repaint_start
=
ME_FindItemFwd
(
editor
->
pBuffer
->
pFirst
,
diParagraph
);
repaint_end
=
editor
->
pBuffer
->
pLast
;
ME_MarkForPainting
(
editor
,
repaint_start
,
repaint_end
);
}
else
{
/* if the start part of selection is being expanded or contracted... */
if
(
nStart
<
editor
->
nLastSelStart
)
{
ME_MarkForPainting
(
editor
,
para1
,
editor
->
pLastSelStartPara
->
member
.
para
.
next_para
);
repaint_start
=
sel_start
;
repaint_end
=
editor
->
pLastSelStartPara
->
member
.
para
.
next_para
;
}
else
if
(
nStart
>
editor
->
nLastSelStart
)
{
ME_MarkForPainting
(
editor
,
editor
->
pLastSelStartPara
,
para1
->
member
.
para
.
next_para
);
repaint_start
=
editor
->
pLastSelStartPara
;
repaint_end
=
sel_start
->
member
.
para
.
next_para
;
}
ME_MarkForPainting
(
editor
,
repaint_start
,
repaint_end
);
/* if the end part of selection is being contracted or expanded... */
if
(
nEnd
<
editor
->
nLastSelEnd
)
{
ME_MarkForPainting
(
editor
,
para2
,
editor
->
pLastSelEndPara
->
member
.
para
.
next_para
);
if
(
!
repaint_start
)
repaint_start
=
sel_end
;
repaint_end
=
editor
->
pLastSelEndPara
->
member
.
para
.
next_para
;
ME_MarkForPainting
(
editor
,
sel_end
,
repaint_end
);
}
else
if
(
nEnd
>
editor
->
nLastSelEnd
)
{
ME_MarkForPainting
(
editor
,
editor
->
pLastSelEndPara
,
para2
->
member
.
para
.
next_para
);
if
(
!
repaint_start
)
repaint_start
=
editor
->
pLastSelEndPara
;
repaint_end
=
sel_end
->
member
.
para
.
next_para
;
ME_MarkForPainting
(
editor
,
editor
->
pLastSelEndPara
,
repaint_end
);
}
}
ME_InvalidateMarkedParagraphs
(
editor
);
ME_InvalidateMarkedParagraphs
(
editor
,
repaint_start
,
repaint_end
);
/* remember the last invalidated position */
ME_GetSelectionOfs
(
editor
,
&
editor
->
nLastSelStart
,
&
editor
->
nLastSelEnd
);
ME_GetSelectionParas
(
editor
,
&
editor
->
pLastSelStartPara
,
&
editor
->
pLastSelEndPara
);
...
...
dlls/riched20/wrap.c
View file @
1f8cbe16
...
...
@@ -583,12 +583,22 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
tp
->
member
.
para
.
nRows
=
wc
.
nRow
;
}
static
void
ME_MarkRepaintEnd
(
ME_DisplayItem
*
para
,
ME_DisplayItem
**
repaint_start
,
ME_DisplayItem
**
repaint_end
)
{
if
(
!*
repaint_start
)
*
repaint_start
=
para
;
*
repaint_end
=
para
->
member
.
para
.
next_para
;
para
->
member
.
para
.
nFlags
|=
MEPF_REPAINT
;
}
BOOL
ME_WrapMarkedParagraphs
(
ME_TextEditor
*
editor
)
{
ME_DisplayItem
*
item
;
ME_Context
c
;
BOOL
bModified
=
FALSE
;
int
totalWidth
=
0
;
ME_DisplayItem
*
repaint_start
=
NULL
,
*
repaint_end
=
NULL
;
ME_InitContext
(
&
c
,
editor
,
ITextHost_TxGetDC
(
editor
->
texthost
));
c
.
pt
.
x
=
0
;
...
...
@@ -605,9 +615,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
ME_WrapTextParagraph
(
&
c
,
item
);
if
(
bRedraw
)
item
->
member
.
para
.
nFlags
|=
MEPF_REPAINT
;
bModified
=
bModified
|
bRedraw
;
ME_MarkRepaintEnd
(
item
,
&
repaint_start
,
&
repaint_end
);
if
(
item
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
{
...
...
@@ -678,10 +686,10 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
{
/* The height of the cells has grown, so invalidate the bottom of
* the cells. */
item
->
member
.
para
.
nFlags
|=
MEPF_REPAINT
;
ME_MarkRepaintEnd
(
item
,
&
repaint_start
,
&
repaint_end
)
;
cell
=
ME_FindItemBack
(
item
,
diCell
);
while
(
cell
)
{
ME_
FindItemBack
(
cell
,
diParagraph
)
->
member
.
para
.
nFlags
|=
MEPF_REPAINT
;
ME_
MarkRepaintEnd
(
ME_FindItemBack
(
cell
,
diParagraph
),
&
repaint_start
,
&
repaint_end
)
;
cell
=
cell
->
member
.
cell
.
prev_cell
;
}
}
...
...
@@ -729,12 +737,17 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
ME_DestroyContext
(
&
c
);
if
(
bModified
||
editor
->
nTotalLength
<
editor
->
nLastTotalLength
)
ME_InvalidateMarkedParagraphs
(
editor
);
return
bModified
;
if
(
repaint_start
||
editor
->
nTotalLength
<
editor
->
nLastTotalLength
)
{
if
(
!
repaint_start
)
repaint_start
=
editor
->
pBuffer
->
pFirst
;
ME_InvalidateMarkedParagraphs
(
editor
,
repaint_start
,
repaint_end
);
}
return
!!
repaint_start
;
}
void
ME_InvalidateMarkedParagraphs
(
ME_TextEditor
*
editor
)
void
ME_InvalidateMarkedParagraphs
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
start_para
,
ME_DisplayItem
*
end_para
)
{
ME_Context
c
;
RECT
rc
;
...
...
@@ -745,13 +758,11 @@ void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor)
rc
=
c
.
rcView
;
ofs
=
editor
->
vert_si
.
nPos
;
item
=
editor
->
pBuffer
->
pFirst
;
while
(
item
!=
editor
->
pBuffer
->
pLast
)
{
item
=
start_para
;
while
(
item
&&
item
!=
end_para
)
{
if
(
item
->
member
.
para
.
nFlags
&
MEPF_REPAINT
)
{
rc
.
top
=
c
.
rcView
.
top
+
item
->
member
.
para
.
pt
.
y
-
ofs
;
rc
.
bottom
=
max
(
c
.
rcView
.
top
+
item
->
member
.
para
.
pt
.
y
+
item
->
member
.
para
.
nHeight
-
ofs
,
c
.
rcView
.
bottom
);
rc
.
bottom
=
max
(
rc
.
top
+
item
->
member
.
para
.
nHeight
,
c
.
rcView
.
bottom
);
ITextHost_TxInvalidateRect
(
editor
->
texthost
,
&
rc
,
TRUE
);
item
->
member
.
para
.
nFlags
&=
~
MEPF_REPAINT
;
}
...
...
Vitaly Lipatov
@lav
mentioned in commit
104920d0
·
Sep 03, 2020
mentioned in commit
104920d0
mentioned in commit 104920d0b6cfada564a48e8be3e553d7a68357f3
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment