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
2e2988de
Commit
2e2988de
authored
Jun 10, 2002
by
Paul Rupe
Committed by
Alexandre Julliard
Jun 10, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Faster performance in TEXT_Ellipsify for long strings.
parent
21fbb40c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
text.c
dlls/user/text.c
+19
-0
No files found.
dlls/user/text.c
View file @
2e2988de
...
...
@@ -135,12 +135,31 @@ static void TEXT_Ellipsify (HDC hdc, WCHAR *str, unsigned int max_len,
int
*
len_before
,
int
*
len_ellip
)
{
unsigned
int
len_ellipsis
;
unsigned
int
lo
,
mid
,
hi
;
len_ellipsis
=
strlenW
(
ELLIPSISW
);
if
(
len_ellipsis
>
max_len
)
len_ellipsis
=
max_len
;
if
(
*
len_str
>
max_len
-
len_ellipsis
)
*
len_str
=
max_len
-
len_ellipsis
;
/* First do a quick binary search to get an upper bound for *len_str. */
if
(
*
len_str
>
0
&&
GetTextExtentExPointW
(
hdc
,
str
,
*
len_str
,
width
,
NULL
,
NULL
,
size
)
&&
size
->
cx
>
width
)
{
for
(
lo
=
0
,
hi
=
*
len_str
;
lo
<
hi
;
)
{
mid
=
(
lo
+
hi
)
/
2
;
if
(
!
GetTextExtentExPointW
(
hdc
,
str
,
mid
,
width
,
NULL
,
NULL
,
size
))
break
;
if
(
size
->
cx
>
width
)
hi
=
mid
;
else
lo
=
mid
+
1
;
}
*
len_str
=
hi
;
}
/* Now this should take only a couple iterations at most. */
for
(
;
;
)
{
strncpyW
(
str
+
*
len_str
,
ELLIPSISW
,
len_ellipsis
);
...
...
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