gdi32: Avoid some rounding errors in AngleArc.

This commit is contained in:
Alexandre Julliard 2010-04-09 18:16:08 +02:00
parent 76a9712779
commit bd5ccea53f
2 changed files with 8 additions and 8 deletions

View file

@ -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,

View file

@ -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);
}