Module: wine Branch: master Commit: bd5ccea53f088fca4a8716c876587abd3ee9e8f7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=bd5ccea53f088fca4a8716c876...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Apr 9 18:16:08 2010 +0200
gdi32: Avoid some rounding errors in AngleArc.
---
dlls/gdi32/painting.c | 8 ++++---- dlls/gdi32/tests/path.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c index fa498e0..1bcdc23 100644 --- a/dlls/gdi32/painting.c +++ b/dlls/gdi32/painting.c @@ -854,8 +854,8 @@ BOOL WINAPI AngleArc(HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAngle, F if(!dc) return FALSE;
/* Calculate the end point */ - x2 = x + cos((eStartAngle+eSweepAngle)*M_PI/180) * dwRadius; - y2 = y - sin((eStartAngle+eSweepAngle)*M_PI/180) * dwRadius; + x2 = GDI_ROUND( x + cos((eStartAngle+eSweepAngle)*M_PI/180) * dwRadius ); + y2 = GDI_ROUND( y - sin((eStartAngle+eSweepAngle)*M_PI/180) * dwRadius );
if(!PATH_IsPathOpen(dc->path) && dc->funcs->pAngleArc) { @@ -863,8 +863,8 @@ BOOL WINAPI AngleArc(HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAngle, F result = dc->funcs->pAngleArc( dc->physDev, x, y, dwRadius, eStartAngle, eSweepAngle ); } else { /* do it using ArcTo */ - x1 = x + cos(eStartAngle*M_PI/180) * dwRadius; - y1 = y - sin(eStartAngle*M_PI/180) * dwRadius; + x1 = GDI_ROUND( x + cos(eStartAngle*M_PI/180) * dwRadius ); + y1 = GDI_ROUND( y - sin(eStartAngle*M_PI/180) * dwRadius );
arcdir = SetArcDirection( hdc, eSweepAngle >= 0 ? AD_COUNTERCLOCKWISE : AD_CLOCKWISE); result = ArcTo( hdc, x-dwRadius, y-dwRadius, x+dwRadius, y+dwRadius, diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c index 4a8ea6d..66cd039 100644 --- a/dlls/gdi32/tests/path.c +++ b/dlls/gdi32/tests/path.c @@ -260,9 +260,9 @@ static const path_test_t anglearc_path[] = { {245, 200, PT_BEZIERTO, 0, 0}, /* 5 */ {200, 245, PT_BEZIERTO, 0, 0}, /* 6 */ {200, 300, PT_BEZIERTO, 0, 0}, /* 7 */ - {200, 300, PT_BEZIERTO, 0, 2}, /* 8 */ - {200, 300, PT_BEZIERTO, 0, 2}, /* 9 */ - {200, 300, PT_BEZIERTO, 0, 2}, /* 10 */ + {200, 300, PT_BEZIERTO, 0, 0}, /* 8 */ + {200, 300, PT_BEZIERTO, 0, 0}, /* 9 */ + {200, 300, PT_BEZIERTO, 0, 0}, /* 10 */ {231, 260, PT_LINETO, 0, 0}, /* 11 */ {245, 235, PT_BEZIERTO, 0, 0}, /* 12 */ {271, 220, PT_BEZIERTO, 0, 0}, /* 13 */ @@ -289,7 +289,7 @@ static void test_anglearc(void) CloseFigure(hdc); EndPath(hdc);
- ok_path(hdc, "anglearc_path", anglearc_path, sizeof(anglearc_path)/sizeof(path_test_t), 1); + ok_path(hdc, "anglearc_path", anglearc_path, sizeof(anglearc_path)/sizeof(path_test_t), 0); done: ReleaseDC(0, hdc); }