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
e5c614e6
Commit
e5c614e6
authored
Jul 10, 2009
by
Huw Davies
Committed by
Alexandre Julliard
Jul 13, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32/tests: Allow a small tolerance when comparing scaling values.
parent
54870c14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
27 deletions
+21
-27
metafile.c
dlls/gdi32/tests/metafile.c
+21
-27
No files found.
dlls/gdi32/tests/metafile.c
View file @
e5c614e6
...
...
@@ -2308,19 +2308,14 @@ static void test_SetWinMetaFileBits(void)
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
/* This is somewhat different to MulDiv, but appears to be how native behaves */
static
INT
muldiv
(
INT
m1
,
INT
m2
,
INT
d
)
static
BOOL
near_match
(
int
x
,
int
y
)
{
LONGLONG
ret
;
int
epsilon
=
min
(
abs
(
x
),
abs
(
y
))
;
ret
=
((
LONGLONG
)
m1
*
m2
+
d
/
2
)
/
d
;
/* Always add d/2 even if ret will be -ve */
epsilon
=
max
(
epsilon
/
100
,
2
);
if
((
LONGLONG
)
m1
*
m2
*
2
==
(
2
*
ret
-
1
)
*
d
)
/* If the answer is exactly n.5 round towards zero */
{
if
(
ret
>
0
)
ret
--
;
else
ret
++
;
}
return
ret
;
if
(
x
<
y
-
epsilon
||
x
>
y
+
epsilon
)
return
FALSE
;
return
TRUE
;
}
static
void
getwinmetafilebits
(
UINT
mode
,
int
scale
,
RECT
*
rc
)
...
...
@@ -2422,43 +2417,42 @@ static void getwinmetafilebits(UINT mode, int scale, RECT *rc)
case
MM_TEXT
:
case
MM_ISOTROPIC
:
case
MM_ANISOTROPIC
:
pt
.
y
=
muldiv
(
rc
->
top
,
vert_res
,
vert_size
*
100
)
;
pt
.
x
=
muld
iv
(
rc
->
left
,
horz_res
,
horz_size
*
100
);
pt
.
y
=
MulDiv
(
rc
->
top
,
vert_res
,
vert_size
*
100
)
+
1
;
pt
.
x
=
MulD
iv
(
rc
->
left
,
horz_res
,
horz_size
*
100
);
break
;
case
MM_LOMETRIC
:
pt
.
y
=
muld
iv
(
-
rc
->
top
,
1
,
10
)
+
1
;
pt
.
x
=
muld
iv
(
rc
->
left
,
1
,
10
);
pt
.
y
=
MulD
iv
(
-
rc
->
top
,
1
,
10
)
+
1
;
pt
.
x
=
MulD
iv
(
rc
->
left
,
1
,
10
);
break
;
case
MM_HIMETRIC
:
pt
.
y
=
-
rc
->
top
+
1
;
pt
.
x
=
(
rc
->
left
>=
0
)
?
rc
->
left
:
rc
->
left
+
1
;
/* strange but true */
break
;
case
MM_LOENGLISH
:
pt
.
y
=
muld
iv
(
-
rc
->
top
,
10
,
254
)
+
1
;
pt
.
x
=
muld
iv
(
rc
->
left
,
10
,
254
);
pt
.
y
=
MulD
iv
(
-
rc
->
top
,
10
,
254
)
+
1
;
pt
.
x
=
MulD
iv
(
rc
->
left
,
10
,
254
);
break
;
case
MM_HIENGLISH
:
pt
.
y
=
muld
iv
(
-
rc
->
top
,
100
,
254
)
+
1
;
pt
.
x
=
muld
iv
(
rc
->
left
,
100
,
254
);
pt
.
y
=
MulD
iv
(
-
rc
->
top
,
100
,
254
)
+
1
;
pt
.
x
=
MulD
iv
(
rc
->
left
,
100
,
254
);
break
;
case
MM_TWIPS
:
pt
.
y
=
muld
iv
(
-
rc
->
top
,
72
*
20
,
2540
)
+
1
;
pt
.
x
=
muld
iv
(
rc
->
left
,
72
*
20
,
2540
);
pt
.
y
=
MulD
iv
(
-
rc
->
top
,
72
*
20
,
2540
)
+
1
;
pt
.
x
=
MulD
iv
(
rc
->
left
,
72
*
20
,
2540
);
break
;
default:
pt
.
x
=
pt
.
y
=
0
;
}
ok
((
short
)
rec
->
rdParm
[
0
]
==
pt
.
y
||
broken
(
mode
>=
MM_LOMETRIC
&&
mode
<=
MM_TWIPS
&&
(
short
)
rec
->
rdParm
[
0
]
==
pt
.
y
-
1
),
/* win9x, winme */
"got %d expect %d
\n
"
,
(
short
)
rec
->
rdParm
[
0
],
pt
.
y
);
ok
((
short
)
rec
->
rdParm
[
1
]
==
pt
.
x
,
"got %d expect %d
\n
"
,
(
short
)
rec
->
rdParm
[
1
],
pt
.
x
);
ok
(
near_match
((
short
)
rec
->
rdParm
[
0
],
pt
.
y
),
"got %d expect %d
\n
"
,
(
short
)
rec
->
rdParm
[
0
],
pt
.
y
);
ok
(
near_match
((
short
)
rec
->
rdParm
[
1
],
pt
.
x
),
"got %d expect %d
\n
"
,
(
short
)
rec
->
rdParm
[
1
],
pt
.
x
);
}
if
(
rec_num
==
mfcomment_chunks
+
2
)
{
ok
(
rec
->
rdFunction
==
META_SETWINDOWEXT
,
"got %04x
\n
"
,
rec
->
rdFunction
);
ok
((
short
)
rec
->
rdParm
[
0
]
==
muldiv
(
rc
->
bottom
-
rc
->
top
,
vert_res
,
vert_size
*
100
),
"got %d
\n
"
,
(
short
)
rec
->
rdParm
[
0
]);
ok
((
short
)
rec
->
rdParm
[
1
]
==
muldiv
(
rc
->
right
-
rc
->
left
,
horz_res
,
horz_size
*
100
),
"got %d
\n
"
,
(
short
)
rec
->
rdParm
[
1
]);
ok
(
near_match
((
short
)
rec
->
rdParm
[
0
],
MulDiv
(
rc
->
bottom
-
rc
->
top
,
vert_res
,
vert_size
*
100
)),
"got %d
\n
"
,
(
short
)
rec
->
rdParm
[
0
]);
ok
(
near_match
((
short
)
rec
->
rdParm
[
1
],
MulDiv
(
rc
->
right
-
rc
->
left
,
horz_res
,
horz_size
*
100
)),
"got %d
\n
"
,
(
short
)
rec
->
rdParm
[
1
]);
}
rec_num
++
;
...
...
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