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
c8055b5b
Commit
c8055b5b
authored
Aug 22, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Aug 22, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: GdipMeasureCharacterRanges should respect device units and transformations.
parent
1418cd79
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
12 deletions
+26
-12
graphics.c
dlls/gdiplus/graphics.c
+26
-7
graphics.c
dlls/gdiplus/tests/graphics.c
+0
-5
No files found.
dlls/gdiplus/graphics.c
View file @
c8055b5b
...
...
@@ -4874,6 +4874,7 @@ GpStatus gdip_format_string(HDC hdc,
struct
measure_ranges_args
{
GpRegion
**
regions
;
REAL
rel_width
,
rel_height
;
};
static
GpStatus
measure_ranges_callback
(
HDC
hdc
,
...
...
@@ -4895,16 +4896,16 @@ static GpStatus measure_ranges_callback(HDC hdc,
GpRectF
range_rect
;
SIZE
range_size
;
range_rect
.
Y
=
bounds
->
Y
;
range_rect
.
Height
=
bounds
->
Height
;
range_rect
.
Y
=
bounds
->
Y
/
args
->
rel_height
;
range_rect
.
Height
=
bounds
->
Height
/
args
->
rel_height
;
GetTextExtentExPointW
(
hdc
,
string
+
index
,
range_start
-
index
,
INT_MAX
,
NULL
,
NULL
,
&
range_size
);
range_rect
.
X
=
bounds
->
X
+
range_size
.
cx
;
range_rect
.
X
=
(
bounds
->
X
+
range_size
.
cx
)
/
args
->
rel_width
;
GetTextExtentExPointW
(
hdc
,
string
+
index
,
range_end
-
index
,
INT_MAX
,
NULL
,
NULL
,
&
range_size
);
range_rect
.
Width
=
(
bounds
->
X
+
range_size
.
cx
)
-
range_rect
.
X
;
range_rect
.
Width
=
(
bounds
->
X
+
range_size
.
cx
-
range_rect
.
X
)
/
args
->
rel_width
;
stat
=
GdipCombineRegionRect
(
args
->
regions
[
i
],
&
range_rect
,
CombineModeUnion
);
if
(
stat
!=
Ok
)
...
...
@@ -4926,6 +4927,8 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
HFONT
oldfont
;
struct
measure_ranges_args
args
;
HDC
hdc
,
temp_hdc
=
NULL
;
GpPointF
pt
[
3
];
RectF
scaled_rect
;
TRACE
(
"(%p %s %d %p %s %p %d %p)
\n
"
,
graphics
,
debugstr_w
(
string
),
length
,
font
,
debugstr_rectf
(
layoutRect
),
stringFormat
,
regionCount
,
regions
);
...
...
@@ -4936,8 +4939,6 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
if
(
regionCount
<
stringFormat
->
range_count
)
return
InvalidParameter
;
get_log_fontW
(
font
,
graphics
,
&
lfw
);
if
(
!
graphics
->
hdc
)
{
hdc
=
temp_hdc
=
CreateCompatibleDC
(
0
);
...
...
@@ -4949,6 +4950,24 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
if
(
stringFormat
->
attr
)
TRACE
(
"may be ignoring some format flags: attr %x
\n
"
,
stringFormat
->
attr
);
pt
[
0
].
X
=
0
.
0
;
pt
[
0
].
Y
=
0
.
0
;
pt
[
1
].
X
=
1
.
0
;
pt
[
1
].
Y
=
0
.
0
;
pt
[
2
].
X
=
0
.
0
;
pt
[
2
].
Y
=
1
.
0
;
GdipTransformPoints
(
graphics
,
CoordinateSpaceDevice
,
CoordinateSpaceWorld
,
pt
,
3
);
args
.
rel_width
=
sqrt
((
pt
[
1
].
Y
-
pt
[
0
].
Y
)
*
(
pt
[
1
].
Y
-
pt
[
0
].
Y
)
+
(
pt
[
1
].
X
-
pt
[
0
].
X
)
*
(
pt
[
1
].
X
-
pt
[
0
].
X
));
args
.
rel_height
=
sqrt
((
pt
[
2
].
Y
-
pt
[
0
].
Y
)
*
(
pt
[
2
].
Y
-
pt
[
0
].
Y
)
+
(
pt
[
2
].
X
-
pt
[
0
].
X
)
*
(
pt
[
2
].
X
-
pt
[
0
].
X
));
scaled_rect
.
X
=
layoutRect
->
X
*
args
.
rel_width
;
scaled_rect
.
Y
=
layoutRect
->
Y
*
args
.
rel_height
;
scaled_rect
.
Width
=
layoutRect
->
Width
*
args
.
rel_width
;
scaled_rect
.
Height
=
layoutRect
->
Height
*
args
.
rel_height
;
get_log_fontW
(
font
,
graphics
,
&
lfw
);
oldfont
=
SelectObject
(
hdc
,
CreateFontIndirectW
(
&
lfw
));
for
(
i
=
0
;
i
<
stringFormat
->
range_count
;
i
++
)
...
...
@@ -4960,7 +4979,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
args
.
regions
=
regions
;
stat
=
gdip_format_string
(
hdc
,
string
,
length
,
font
,
layoutR
ect
,
stringFormat
,
stat
=
gdip_format_string
(
hdc
,
string
,
length
,
font
,
&
scaled_r
ect
,
stringFormat
,
measure_ranges_callback
,
&
args
);
DeleteObject
(
SelectObject
(
hdc
,
oldfont
));
...
...
dlls/gdiplus/tests/graphics.c
View file @
c8055b5b
...
...
@@ -3847,11 +3847,6 @@ static void test_font_height_scaling(void)
win_skip
(
"GdipMeasureCharacterRanges ignores units before Win7
\n
"
);
continue
;
}
/* FIXME: remove once Wine is fixed */
if
(
gfx_unit
==
UnitPixel
)
expectf_
(
height
,
rect
.
Height
,
height
/
15
.
0
);
else
todo_wine
expectf_
(
height
,
rect
.
Height
,
height
/
15
.
0
);
todo_wine
expectf_
(
bounds
.
Width
,
rect
.
Width
+
margin
*
2
.
0
,
bounds
.
Width
/
25
.
0
);
...
...
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