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
ec09a400
Commit
ec09a400
authored
Sep 27, 1999
by
Francis Beaudet
Committed by
Alexandre Julliard
Sep 27, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DPtoLP needs to round the result.
Fixed MulDiv to deal better with negative numbers.
parent
d3d24770
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
10 deletions
+39
-10
gdi.h
include/gdi.h
+8
-8
gdiobj.c
objects/gdiobj.c
+31
-2
No files found.
include/gdi.h
View file @
ec09a400
...
...
@@ -402,24 +402,24 @@ static inline void WINE_UNUSED INTERNAL_LPTODP(DC *dc, LPPOINT point)
}
#define XDPTOLP(dc,x) \
(
((x)-(dc)->vportOrgX) * (dc)->wndExtX / (dc)->vportExtX+
(dc)->wndOrgX)
(
MulDiv(((x)-(dc)->vportOrgX), (dc)->wndExtX, (dc)->vportExtX) +
(dc)->wndOrgX)
#define YDPTOLP(dc,y) \
(
((y)-(dc)->vportOrgY) * (dc)->wndExtY / (dc)->vportExtY+
(dc)->wndOrgY)
(
MulDiv(((y)-(dc)->vportOrgY), (dc)->wndExtY, (dc)->vportExtY) +
(dc)->wndOrgY)
#define XLPTODP(dc,x) \
(
((x)-(dc)->wndOrgX) * (dc)->vportExtX / (dc)->wndExtX+
(dc)->vportOrgX)
(
MulDiv(((x)-(dc)->wndOrgX), (dc)->vportExtX, (dc)->wndExtX) +
(dc)->vportOrgX)
#define YLPTODP(dc,y) \
(
((y)-(dc)->wndOrgY) * (dc)->vportExtY / (dc)->wndExtY+
(dc)->vportOrgY)
(
MulDiv(((y)-(dc)->wndOrgY), (dc)->vportExtY, (dc)->wndExtY) +
(dc)->vportOrgY)
/* Device <-> logical size conversion */
#define XDSTOLS(dc,x) \
((x) * (dc)->wndExtX /
(dc)->vportExtX)
MulDiv((x), (dc)->wndExtX,
(dc)->vportExtX)
#define YDSTOLS(dc,y) \
((y) * (dc)->wndExtY /
(dc)->vportExtY)
MulDiv((y), (dc)->wndExtY,
(dc)->vportExtY)
#define XLSTODS(dc,x) \
((x) * (dc)->vportExtX /
(dc)->wndExtX)
MulDiv((x), (dc)->vportExtX,
(dc)->wndExtX)
#define YLSTODS(dc,y) \
((y) * (dc)->vportExtY /
(dc)->wndExtY)
MulDiv((y), (dc)->vportExtY,
(dc)->wndExtY)
/* GDI local heap */
...
...
objects/gdiobj.c
View file @
ec09a400
...
...
@@ -1029,13 +1029,42 @@ INT WINAPI MulDiv(
)
{
#if (SIZEOF_LONG_LONG >= 8)
long
long
ret
;
if
(
!
nDivisor
)
return
-
1
;
ret
=
(((
long
long
)
nMultiplicand
*
nMultiplier
)
+
(
nDivisor
/
2
))
/
nDivisor
;
/* We want to deal with a positive divisor to simplify the logic. */
if
(
nDivisor
<
0
)
{
nMultiplicand
=
-
nMultiplicand
;
nDivisor
=
-
nDivisor
;
}
/* If the result is positive, we "add" to round. else, we subtract to round. */
if
(
(
(
nMultiplicand
<
0
)
&&
(
nMultiplier
<
0
)
)
||
(
(
nMultiplicand
>=
0
)
&&
(
nMultiplier
>=
0
)
)
)
ret
=
(((
long
long
)
nMultiplicand
*
nMultiplier
)
+
(
nDivisor
/
2
))
/
nDivisor
;
else
ret
=
(((
long
long
)
nMultiplicand
*
nMultiplier
)
-
(
nDivisor
/
2
))
/
nDivisor
;
if
((
ret
>
2147483647
)
||
(
ret
<
-
2147483647
))
return
-
1
;
return
ret
;
#else
if
(
!
nDivisor
)
return
-
1
;
return
((
nMultiplicand
*
nMultiplier
)
+
(
nDivisor
/
2
))
/
nDivisor
;
/* We want to deal with a positive divisor to simplify the logic. */
if
(
nDivisor
<
0
)
{
nMultiplicand
=
-
nMultiplicand
;
nDivisor
=
-
nDivisor
;
}
/* If the result is positive, we "add" to round. else, we subtract to round. */
if
(
(
(
nMultiplicand
<
0
)
&&
(
nMultiplier
<
0
)
)
||
(
(
nMultiplicand
>=
0
)
&&
(
nMultiplier
>=
0
)
)
)
return
((
nMultiplicand
*
nMultiplier
)
+
(
nDivisor
/
2
))
/
nDivisor
;
return
((
nMultiplicand
*
nMultiplier
)
-
(
nDivisor
/
2
))
/
nDivisor
;
#endif
}
/*******************************************************************
...
...
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