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
b20a1f56
Commit
b20a1f56
authored
Jul 16, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: GdipMeasureString operates internally in pixels but in/out rectangles are in device units.
parent
9288acda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
9 deletions
+32
-9
graphics.c
dlls/gdiplus/graphics.c
+32
-3
graphics.c
dlls/gdiplus/tests/graphics.c
+0
-6
No files found.
dlls/gdiplus/graphics.c
View file @
b20a1f56
...
...
@@ -4908,6 +4908,30 @@ static GpStatus measure_ranges_callback(HDC hdc,
return
stat
;
}
static
void
rect_to_pixels
(
const
RectF
*
in
,
const
GpGraphics
*
graphics
,
RectF
*
out
)
{
REAL
dpi
;
GdipGetDpiX
((
GpGraphics
*
)
graphics
,
&
dpi
);
out
->
X
=
units_to_pixels
(
in
->
X
,
graphics
->
unit
,
dpi
);
out
->
Width
=
units_to_pixels
(
in
->
Width
,
graphics
->
unit
,
dpi
);
GdipGetDpiY
((
GpGraphics
*
)
graphics
,
&
dpi
);
out
->
Y
=
units_to_pixels
(
in
->
Y
,
graphics
->
unit
,
dpi
);
out
->
Height
=
units_to_pixels
(
in
->
Height
,
graphics
->
unit
,
dpi
);
}
static
void
rect_to_units
(
const
RectF
*
in
,
const
GpGraphics
*
graphics
,
RectF
*
out
)
{
REAL
dpi
;
GdipGetDpiX
((
GpGraphics
*
)
graphics
,
&
dpi
);
out
->
X
=
pixels_to_units
(
in
->
X
,
graphics
->
unit
,
dpi
);
out
->
Width
=
pixels_to_units
(
in
->
Width
,
graphics
->
unit
,
dpi
);
GdipGetDpiY
((
GpGraphics
*
)
graphics
,
&
dpi
);
out
->
Y
=
pixels_to_units
(
in
->
Y
,
graphics
->
unit
,
dpi
);
out
->
Height
=
pixels_to_units
(
in
->
Height
,
graphics
->
unit
,
dpi
);
}
GpStatus
WINGDIPAPI
GdipMeasureCharacterRanges
(
GpGraphics
*
graphics
,
GDIPCONST
WCHAR
*
string
,
INT
length
,
GDIPCONST
GpFont
*
font
,
GDIPCONST
RectF
*
layoutRect
,
GDIPCONST
GpStringFormat
*
stringFormat
,
...
...
@@ -5011,6 +5035,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
struct
measure_string_args
args
;
HDC
temp_hdc
=
NULL
,
hdc
;
GpPointF
pt
[
3
];
RectF
rect_pixels
;
TRACE
(
"(%p, %s, %i, %p, %s, %p, %p, %p, %p)
\n
"
,
graphics
,
debugstr_wn
(
string
,
length
),
length
,
font
,
debugstr_rectf
(
rect
),
format
,
...
...
@@ -5048,8 +5073,10 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
get_font_hfont
(
graphics
,
font
,
&
gdifont
);
oldfont
=
SelectObject
(
hdc
,
gdifont
);
bounds
->
X
=
rect
->
X
;
bounds
->
Y
=
rect
->
Y
;
rect_to_pixels
(
rect
,
graphics
,
&
rect_pixels
);
bounds
->
X
=
rect_pixels
.
X
;
bounds
->
Y
=
rect_pixels
.
Y
;
bounds
->
Width
=
0
.
0
;
bounds
->
Height
=
0
.
0
;
...
...
@@ -5057,9 +5084,11 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
args
.
codepointsfitted
=
codepointsfitted
;
args
.
linesfilled
=
linesfilled
;
gdip_format_string
(
hdc
,
string
,
length
,
font
,
rect
,
format
,
gdip_format_string
(
hdc
,
string
,
length
,
font
,
&
rect_pixels
,
format
,
measure_string_callback
,
&
args
);
rect_to_units
(
bounds
,
graphics
,
bounds
);
SelectObject
(
hdc
,
oldfont
);
DeleteObject
(
gdifont
);
...
...
dlls/gdiplus/tests/graphics.c
View file @
b20a1f56
...
...
@@ -3350,9 +3350,7 @@ static void test_GdipMeasureString(void)
expect
(
Ok
,
status
);
expectf
(
0
.
0
,
bounds
.
X
);
expectf
(
0
.
0
,
bounds
.
Y
);
todo_wine
expectf_
(
102
.
499985
,
bounds
.
Width
,
11
.
5
);
todo_wine
expectf_
(
31
.
968744
,
bounds
.
Height
,
3
.
1
);
}
else
...
...
@@ -3372,9 +3370,7 @@ todo_wine
expect
(
Ok
,
status
);
expectf
(
0
.
0
,
bounds
.
X
);
expectf
(
0
.
0
,
bounds
.
Y
);
todo_wine
expectf_
(
76
.
875000
,
bounds
.
Width
,
10
.
0
);
todo_wine
expectf_
(
23
.
976563
,
bounds
.
Height
,
2
.
1
);
status
=
GdipSetPageUnit
(
graphics
,
UnitMillimeter
);
...
...
@@ -3391,9 +3387,7 @@ todo_wine
expect
(
Ok
,
status
);
expectf
(
0
.
0
,
bounds
.
X
);
expectf
(
0
.
0
,
bounds
.
Y
);
todo_wine
expectf_
(
27
.
119789
,
bounds
.
Width
,
2
.
7
);
todo_wine
expectf_
(
8
.
458398
,
bounds
.
Height
,
0
.
8
);
GdipDeleteStringFormat
(
format
);
...
...
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