Commit 2b0cddbf authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiArcInternal for ArcTo implementation.

parent c16bf295
...@@ -54,3 +54,16 @@ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom, ...@@ -54,3 +54,16 @@ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
return NtGdiArcInternal( NtGdiArc, hdc, left, top, right, bottom, return NtGdiArcInternal( NtGdiArc, hdc, left, top, right, bottom,
xstart, ystart, xend, yend ); xstart, ystart, xend, yend );
} }
/***********************************************************************
* ArcTo (GDI32.@)
*/
BOOL WINAPI ArcTo( HDC hdc, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
right, bottom, xstart, ystart, xend, yend );
return NtGdiArcInternal( NtGdiArcTo, hdc, left, top, right, bottom,
xstart, ystart, xend, yend );
}
...@@ -293,6 +293,29 @@ BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right, ...@@ -293,6 +293,29 @@ BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right,
physdev = GET_DC_PHYSDEV( dc, pArc ); physdev = GET_DC_PHYSDEV( dc, pArc );
ret = physdev->funcs->pArc( physdev, left, top, right, bottom, xstart, ystart, xend, yend ); ret = physdev->funcs->pArc( physdev, left, top, right, bottom, xstart, ystart, xend, yend );
break; break;
case NtGdiArcTo:
{
double width = abs( right - left );
double height = abs( bottom - top );
double xradius = width / 2;
double yradius = height / 2;
double xcenter = right > left ? left + xradius : right + xradius;
double ycenter = bottom > top ? top + yradius : bottom + yradius;
physdev = GET_DC_PHYSDEV( dc, pArcTo );
ret = physdev->funcs->pArcTo( physdev, left, top, right, bottom,
xstart, ystart, xend, yend );
if (ret)
{
double angle = atan2(((yend - ycenter) / height),
((xend - xcenter) / width));
dc->cur_pos.x = GDI_ROUND( xcenter + (cos( angle ) * xradius) );
dc->cur_pos.y = GDI_ROUND( ycenter + (sin( angle ) * yradius) );
}
break;
}
default: default:
WARN( "invalid arc type %u\n", type ); WARN( "invalid arc type %u\n", type );
ret = FALSE; ret = FALSE;
...@@ -302,44 +325,6 @@ BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right, ...@@ -302,44 +325,6 @@ BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right,
return ret; return ret;
} }
/***********************************************************************
* ArcTo (GDI32.@)
*/
BOOL WINAPI ArcTo( HDC hdc,
INT left, INT top,
INT right, INT bottom,
INT xstart, INT ystart,
INT xend, INT yend )
{
double width = abs( right - left ),
height = abs( bottom - top ),
xradius = width/2,
yradius = height/2,
xcenter = right > left ? left+xradius : right+xradius,
ycenter = bottom > top ? top+yradius : bottom+yradius,
angle;
PHYSDEV physdev;
BOOL result;
DC * dc = get_dc_ptr( hdc );
TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top, right, bottom, xstart, ystart, xend, yend );
if(!dc) return FALSE;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pArcTo );
result = physdev->funcs->pArcTo( physdev, left, top, right, bottom, xstart, ystart, xend, yend );
if (result)
{
angle = atan2(((yend-ycenter)/height),
((xend-xcenter)/width));
dc->cur_pos.x = GDI_ROUND( xcenter + (cos( angle ) * xradius) );
dc->cur_pos.y = GDI_ROUND( ycenter + (sin( angle ) * yradius) );
}
release_dc_ptr( dc );
return result;
}
/*********************************************************************** /***********************************************************************
* Pie (GDI32.@) * Pie (GDI32.@)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment