Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
deb6466f
Commit
deb6466f
authored
Mar 30, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Mar 31, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement GdipMeasureCharacterRanges.
parent
f860285c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
7 deletions
+76
-7
graphics.c
dlls/gdiplus/graphics.c
+72
-3
graphics.c
dlls/gdiplus/tests/graphics.c
+4
-4
No files found.
dlls/gdiplus/graphics.c
View file @
deb6466f
...
@@ -3479,18 +3479,87 @@ static GpStatus gdip_format_string(GpGraphics *graphics,
...
@@ -3479,18 +3479,87 @@ static GpStatus gdip_format_string(GpGraphics *graphics,
return
stat
;
return
stat
;
}
}
struct
measure_ranges_args
{
GpRegion
**
regions
;
};
GpStatus
measure_ranges_callback
(
GpGraphics
*
graphics
,
GDIPCONST
WCHAR
*
string
,
INT
index
,
INT
length
,
GDIPCONST
GpFont
*
font
,
GDIPCONST
RectF
*
rect
,
GDIPCONST
GpStringFormat
*
format
,
INT
lineno
,
const
RectF
*
bounds
,
void
*
user_data
)
{
int
i
;
GpStatus
stat
=
Ok
;
struct
measure_ranges_args
*
args
=
user_data
;
for
(
i
=
0
;
i
<
format
->
range_count
;
i
++
)
{
INT
range_start
=
max
(
index
,
format
->
character_ranges
[
i
].
First
);
INT
range_end
=
min
(
index
+
length
,
format
->
character_ranges
[
i
].
First
+
format
->
character_ranges
[
i
].
Length
);
if
(
range_start
<
range_end
)
{
GpRectF
range_rect
;
SIZE
range_size
;
range_rect
.
Y
=
bounds
->
Y
;
range_rect
.
Height
=
bounds
->
Height
;
GetTextExtentExPointW
(
graphics
->
hdc
,
string
+
index
,
range_start
-
index
,
INT_MAX
,
NULL
,
NULL
,
&
range_size
);
range_rect
.
X
=
bounds
->
X
+
range_size
.
cx
;
GetTextExtentExPointW
(
graphics
->
hdc
,
string
+
index
,
range_end
-
index
,
INT_MAX
,
NULL
,
NULL
,
&
range_size
);
range_rect
.
Width
=
(
bounds
->
X
+
range_size
.
cx
)
-
range_rect
.
X
;
stat
=
GdipCombineRegionRect
(
args
->
regions
[
i
],
&
range_rect
,
CombineModeUnion
);
if
(
stat
!=
Ok
)
break
;
}
}
return
stat
;
}
GpStatus
WINGDIPAPI
GdipMeasureCharacterRanges
(
GpGraphics
*
graphics
,
GpStatus
WINGDIPAPI
GdipMeasureCharacterRanges
(
GpGraphics
*
graphics
,
GDIPCONST
WCHAR
*
string
,
INT
length
,
GDIPCONST
GpFont
*
font
,
GDIPCONST
WCHAR
*
string
,
INT
length
,
GDIPCONST
GpFont
*
font
,
GDIPCONST
RectF
*
layoutRect
,
GDIPCONST
GpStringFormat
*
stringFormat
,
GDIPCONST
RectF
*
layoutRect
,
GDIPCONST
GpStringFormat
*
stringFormat
,
INT
regionCount
,
GpRegion
**
regions
)
INT
regionCount
,
GpRegion
**
regions
)
{
{
FIXME
(
"stub: %p %s %d %p %p %p %d %p
\n
"
,
graphics
,
debugstr_w
(
string
),
GpStatus
stat
;
length
,
font
,
layoutRect
,
stringFormat
,
regionCount
,
regions
);
int
i
;
HFONT
oldfont
;
struct
measure_ranges_args
args
;
TRACE
(
"(%p %s %d %p %s %p %d %p)
\n
"
,
graphics
,
debugstr_w
(
string
),
length
,
font
,
debugstr_rectf
(
layoutRect
),
stringFormat
,
regionCount
,
regions
);
if
(
!
(
graphics
&&
string
&&
font
&&
layoutRect
&&
stringFormat
&&
regions
))
if
(
!
(
graphics
&&
string
&&
font
&&
layoutRect
&&
stringFormat
&&
regions
))
return
InvalidParameter
;
return
InvalidParameter
;
return
NotImplemented
;
if
(
regionCount
<
stringFormat
->
range_count
)
return
InvalidParameter
;
if
(
stringFormat
->
attr
)
TRACE
(
"may be ignoring some format flags: attr %x
\n
"
,
stringFormat
->
attr
);
oldfont
=
SelectObject
(
graphics
->
hdc
,
CreateFontIndirectW
(
&
font
->
lfw
));
for
(
i
=
0
;
i
<
stringFormat
->
range_count
;
i
++
)
{
stat
=
GdipSetEmpty
(
regions
[
i
]);
if
(
stat
!=
Ok
)
return
stat
;
}
args
.
regions
=
regions
;
stat
=
gdip_format_string
(
graphics
,
string
,
length
,
font
,
layoutRect
,
stringFormat
,
measure_ranges_callback
,
&
args
);
DeleteObject
(
SelectObject
(
graphics
->
hdc
,
oldfont
));
return
stat
;
}
}
struct
measure_string_args
{
struct
measure_string_args
{
...
...
dlls/gdiplus/tests/graphics.c
View file @
deb6466f
...
@@ -2590,10 +2590,10 @@ static void test_string_functions(void)
...
@@ -2590,10 +2590,10 @@ static void test_string_functions(void)
expect
(
InvalidParameter
,
status
);
expect
(
InvalidParameter
,
status
);
status
=
GdipMeasureCharacterRanges
(
graphics
,
teststring
,
6
,
font
,
&
rc
,
format
,
2
,
regions
);
status
=
GdipMeasureCharacterRanges
(
graphics
,
teststring
,
6
,
font
,
&
rc
,
format
,
2
,
regions
);
todo_wine
expect
(
InvalidParameter
,
status
);
expect
(
InvalidParameter
,
status
);
status
=
GdipMeasureCharacterRanges
(
graphics
,
teststring
,
6
,
font
,
&
rc
,
format
,
4
,
regions
);
status
=
GdipMeasureCharacterRanges
(
graphics
,
teststring
,
6
,
font
,
&
rc
,
format
,
4
,
regions
);
todo_wine
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
{
{
...
@@ -2611,7 +2611,7 @@ static void test_string_functions(void)
...
@@ -2611,7 +2611,7 @@ static void test_string_functions(void)
rc
.
Height
=
char_bounds
.
Height
+
char_height
*
0
.
5
;
rc
.
Height
=
char_bounds
.
Height
+
char_height
*
0
.
5
;
status
=
GdipMeasureCharacterRanges
(
graphics
,
teststring
,
6
,
font
,
&
rc
,
format
,
3
,
regions
);
status
=
GdipMeasureCharacterRanges
(
graphics
,
teststring
,
6
,
font
,
&
rc
,
format
,
3
,
regions
);
todo_wine
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
{
{
...
@@ -2621,7 +2621,7 @@ static void test_string_functions(void)
...
@@ -2621,7 +2621,7 @@ static void test_string_functions(void)
ok
(
!
region_isempty
[
0
],
"region shouldn't be empty
\n
"
);
ok
(
!
region_isempty
[
0
],
"region shouldn't be empty
\n
"
);
ok
(
!
region_isempty
[
1
],
"region shouldn't be empty
\n
"
);
ok
(
!
region_isempty
[
1
],
"region shouldn't be empty
\n
"
);
todo_wine
ok
(
region_isempty
[
2
],
"region should be empty
\n
"
);
ok
(
region_isempty
[
2
],
"region should be empty
\n
"
);
ok
(
!
region_isempty
[
3
],
"region shouldn't be empty
\n
"
);
ok
(
!
region_isempty
[
3
],
"region shouldn't be empty
\n
"
);
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
...
...
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