[PATCH 1/3] gdi32: Set current position properly after ArcTo.

Misha Koshelev mk144210 at bcm.edu
Wed Jun 20 11:58:29 CDT 2007


On Wed, 2007-06-20 at 12:09 +0200, Alexandre Julliard wrote:
> Misha Koshelev <mk144210 at bcm.edu> writes:
> 
> > +        if (!PATH_IsPathOpen(dc->path))
> >          {
> > -            angle = atan2(
> > -                ((yend-ycenter)/height),
> > -                ((xend-xcenter)/width));
> > -            MoveToEx(hdc, GDI_ROUND(xcenter+(cos(angle)*xradius)),
> > -                     GDI_ROUND(ycenter+(sin(angle)*yradius)), NULL);
> > +            if (result && dc->funcs->pMoveTo) result = dc->funcs->pMoveTo(dc->physDev,end.x,end.y);
> 
> It would be cleaner to add a PATH_ArcTo function instead of having
> multiple PATH_IsPathOpen checks in the generic function.
> 

This is a good idea but I am having problems with the implementation.
Specifically, I see two options:

1. PATH_ArcTo calls PATH_LineTo and then PATH_Arc. This works great
except then we have to calculate the actual starting point in both
ArcTo() and PATH_ArcTo() independently (not to mention in
PATH_DoArcPart).

2. We allow arbitrary starting types in the path in PATH_DoArcPart. The
problem is that if pPath->newStroke is true we need to add a PT_MOVETO
to the dc->CursPosX and dc->CursPosY before the PT_LINETO, but
PATH_DoArcPart is not passed a handle or pointer to the DC, and
furthermore it looks like in PATH_WidenPath, PATH_DoArcPart is called on
a path that is not the path selected into a DC, so we can't just use the
DC current position in any case.

Any suggestions? If we have to do it in a PATH function, I guess 1 seems
to be the best way, but we would still be duplicating (well really
triplicating) the code to compute the starting point, and I don't like
that too much.

Thanks
Misha




More information about the wine-devel mailing list