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
6f462555
Commit
6f462555
authored
Aug 15, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Aug 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: GdipMeasureString should apply its internal scaling factors to layout rectangle.
parent
46bbbd27
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
32 deletions
+9
-32
graphics.c
dlls/gdiplus/graphics.c
+8
-2
graphics.c
dlls/gdiplus/tests/graphics.c
+1
-30
No files found.
dlls/gdiplus/graphics.c
View file @
6f462555
...
@@ -4999,7 +4999,7 @@ static GpStatus measure_string_callback(HDC hdc,
...
@@ -4999,7 +4999,7 @@ static GpStatus measure_string_callback(HDC hdc,
REAL
new_width
,
new_height
;
REAL
new_width
,
new_height
;
new_width
=
bounds
->
Width
/
args
->
rel_width
;
new_width
=
bounds
->
Width
/
args
->
rel_width
;
new_height
=
(
bounds
->
Height
+
bounds
->
Y
-
args
->
bounds
->
Y
)
/
args
->
rel_height
;
new_height
=
(
bounds
->
Height
+
bounds
->
Y
)
/
args
->
rel_height
-
args
->
bounds
->
Y
;
if
(
new_width
>
args
->
bounds
->
Width
)
if
(
new_width
>
args
->
bounds
->
Width
)
args
->
bounds
->
Width
=
new_width
;
args
->
bounds
->
Width
=
new_width
;
...
@@ -5029,6 +5029,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
...
@@ -5029,6 +5029,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
struct
measure_string_args
args
;
struct
measure_string_args
args
;
HDC
temp_hdc
=
NULL
,
hdc
;
HDC
temp_hdc
=
NULL
,
hdc
;
GpPointF
pt
[
3
];
GpPointF
pt
[
3
];
RectF
scaled_rect
;
TRACE
(
"(%p, %s, %i, %p, %s, %p, %p, %p, %p)
\n
"
,
graphics
,
TRACE
(
"(%p, %s, %i, %p, %s, %p, %p, %p, %p)
\n
"
,
graphics
,
debugstr_wn
(
string
,
length
),
length
,
font
,
debugstr_rectf
(
rect
),
format
,
debugstr_wn
(
string
,
length
),
length
,
font
,
debugstr_rectf
(
rect
),
format
,
...
@@ -5066,6 +5067,11 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
...
@@ -5066,6 +5067,11 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
get_font_hfont
(
graphics
,
font
,
&
gdifont
);
get_font_hfont
(
graphics
,
font
,
&
gdifont
);
oldfont
=
SelectObject
(
hdc
,
gdifont
);
oldfont
=
SelectObject
(
hdc
,
gdifont
);
scaled_rect
.
X
=
rect
->
X
*
args
.
rel_width
;
scaled_rect
.
Y
=
rect
->
Y
*
args
.
rel_height
;
scaled_rect
.
Width
=
rect
->
Width
*
args
.
rel_width
;
scaled_rect
.
Height
=
rect
->
Height
*
args
.
rel_height
;
bounds
->
X
=
rect
->
X
;
bounds
->
X
=
rect
->
X
;
bounds
->
Y
=
rect
->
Y
;
bounds
->
Y
=
rect
->
Y
;
bounds
->
Width
=
0
.
0
;
bounds
->
Width
=
0
.
0
;
...
@@ -5075,7 +5081,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
...
@@ -5075,7 +5081,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
args
.
codepointsfitted
=
codepointsfitted
;
args
.
codepointsfitted
=
codepointsfitted
;
args
.
linesfilled
=
linesfilled
;
args
.
linesfilled
=
linesfilled
;
gdip_format_string
(
hdc
,
string
,
length
,
font
,
rect
,
format
,
gdip_format_string
(
hdc
,
string
,
length
,
font
,
&
scaled_
rect
,
format
,
measure_string_callback
,
&
args
);
measure_string_callback
,
&
args
);
SelectObject
(
hdc
,
oldfont
);
SelectObject
(
hdc
,
oldfont
);
...
...
dlls/gdiplus/tests/graphics.c
View file @
6f462555
...
@@ -3513,13 +3513,6 @@ static void test_GdipMeasureString(void)
...
@@ -3513,13 +3513,6 @@ static void test_GdipMeasureString(void)
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
expectf
(
50
.
0
,
bounds
.
X
);
expectf
(
50
.
0
,
bounds
.
X
);
expectf
(
50
.
0
,
bounds
.
Y
);
expectf
(
50
.
0
,
bounds
.
Y
);
/* FIXME: remove once Wine is fixed */
if
(
fabs
(
height
-
bounds
.
Height
)
>
height
/
100
.
0
)
{
/* further testing is useless */
GdipDeleteGraphics
(
graphics
);
continue
;
}
expectf_
(
height
,
bounds
.
Height
,
height
/
100
.
0
);
expectf_
(
height
,
bounds
.
Height
,
height
/
100
.
0
);
expectf_
(
bounds
.
Height
/
base_cy
,
bounds
.
Width
/
base_cx
,
0
.
05
);
expectf_
(
bounds
.
Height
/
base_cy
,
bounds
.
Width
/
base_cx
,
0
.
05
);
expect
(
7
,
chars
);
expect
(
7
,
chars
);
...
@@ -3584,23 +3577,8 @@ static void test_GdipMeasureString(void)
...
@@ -3584,23 +3577,8 @@ static void test_GdipMeasureString(void)
base_cy
=
bounds
.
Height
;
base_cy
=
bounds
.
Height
;
}
}
/* FIXME: remove once Wine is fixed */
if
(
fabs
(
height
-
bounds
.
Height
)
>
height
/
85
.
0
)
{
/* further testing is useless */
GdipDeleteGraphics
(
graphics
);
continue
;
}
expectf
(
0
.
0
,
bounds
.
X
);
expectf
(
0
.
0
,
bounds
.
X
);
expectf
(
0
.
0
,
bounds
.
Y
);
expectf
(
0
.
0
,
bounds
.
Y
);
/* FIXME: remove once Wine is fixed */
if
(
fabs
(
height
-
bounds
.
Height
)
>
height
/
85
.
0
)
{
/* further testing is useless */
GdipDeleteGraphics
(
graphics
);
continue
;
}
expectf_
(
height
,
bounds
.
Height
,
height
/
85
.
0
);
expectf_
(
height
,
bounds
.
Height
,
height
/
85
.
0
);
expectf_
(
bounds
.
Height
/
base_cy
,
bounds
.
Width
/
base_cx
,
0
.
05
);
expectf_
(
bounds
.
Height
/
base_cy
,
bounds
.
Width
/
base_cx
,
0
.
05
);
expect
(
7
,
chars
);
expect
(
7
,
chars
);
...
@@ -3617,13 +3595,6 @@ static void test_GdipMeasureString(void)
...
@@ -3617,13 +3595,6 @@ static void test_GdipMeasureString(void)
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
expectf
(
50
.
0
,
bounds
.
X
);
expectf
(
50
.
0
,
bounds
.
X
);
expectf
(
50
.
0
,
bounds
.
Y
);
expectf
(
50
.
0
,
bounds
.
Y
);
/* FIXME: remove once Wine is fixed */
if
(
fabs
(
height
-
bounds
.
Height
)
>
height
/
85
.
0
)
{
/* further testing is useless */
GdipDeleteGraphics
(
graphics
);
continue
;
}
expectf_
(
height
,
bounds
.
Height
,
height
/
85
.
0
);
expectf_
(
height
,
bounds
.
Height
,
height
/
85
.
0
);
expectf_
(
bounds
.
Height
/
base_cy
,
bounds
.
Width
/
base_cx
,
0
.
05
);
expectf_
(
bounds
.
Height
/
base_cy
,
bounds
.
Width
/
base_cx
,
0
.
05
);
expect
(
7
,
chars
);
expect
(
7
,
chars
);
...
@@ -3635,7 +3606,7 @@ static void test_GdipMeasureString(void)
...
@@ -3635,7 +3606,7 @@ static void test_GdipMeasureString(void)
height
*=
td
[
i
].
page_scale
;
height
*=
td
[
i
].
page_scale
;
/*trace("%u: unit %u, %.1fx%.1f dpi, scale %.1f, height %f, pixels %f\n",
/*trace("%u: unit %u, %.1fx%.1f dpi, scale %.1f, height %f, pixels %f\n",
i, td[i].unit, td[i].res_x, td[i].res_y, td[i].page_scale, bounds.Height, height);*/
i, td[i].unit, td[i].res_x, td[i].res_y, td[i].page_scale, bounds.Height, height);*/
expectf_
(
100
.
0
,
height
,
1
.
0
);
expectf_
(
100
.
0
,
height
,
1
.
1
);
status
=
GdipDeleteGraphics
(
graphics
);
status
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
...
...
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