Fix drawing pie fill aligment.

svn path=/trunk/; revision=34207
This commit is contained in:
James Tabor 2008-06-30 05:11:39 +00:00
parent 09f0fa3748
commit d20f879eaf
2 changed files with 17 additions and 9 deletions

View file

@ -133,11 +133,14 @@ IntArc( DC *dc,
RectBounds.right = Right;
RectBounds.top = Top;
RectBounds.bottom = Bottom;
IntLPtoDP(dc, (LPPOINT)&RectBounds, 2);
DPRINT1("1: Left: %d, Top: %d, Right: %d, Bottom: %d\n",
RectBounds.left,RectBounds.top,RectBounds.right,RectBounds.bottom);
RadiusX = (RectBounds.right - RectBounds.left) / 2;
RadiusY = (RectBounds.bottom - RectBounds.top) / 2;
RadiusX = max((RectBounds.right - RectBounds.left) / 2, 1);
RadiusY = max((RectBounds.bottom - RectBounds.top) / 2, 1);
CenterX = (RectBounds.right + RectBounds.left) / 2;
CenterY = (RectBounds.bottom + RectBounds.top) / 2;
AngleEnd = atan2((YRadialEnd - CenterY), XRadialEnd - CenterX)*(360.0/(M_PI*2));
@ -151,13 +154,13 @@ IntArc( DC *dc,
if ((arctype == GdiTypePie) || (arctype == GdiTypeChord))
{
ret = IntFillArc( dc,
RectBounds.left,
RectBounds.left,
RectBounds.top,
fabs(RectBounds.right-RectBounds.left), // Width
fabs(RectBounds.bottom-RectBounds.top), // Height
AngleStart,
AngleEnd,
arctype);
abs(RectBounds.right-RectBounds.left), // Width
abs(RectBounds.bottom-RectBounds.top), // Height
AngleStart,
AngleEnd,
arctype);
}
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);

View file

@ -802,7 +802,12 @@ IntFillArc( PDC dc,
r.y = YLeft;
r.width = Width;
r.height = Height;
app_fill_arc(dc, r, Start-90, End-90, FillBrushObj, Chord);
// Sort out alignment here.
app_fill_arc(dc, r,
(dc->DcLevel.flPath & DCPATH_CLOCKWISE) ? -End : -Start,
(dc->DcLevel.flPath & DCPATH_CLOCKWISE) ? -Start : -End,
FillBrushObj, Chord);
BRUSHOBJ_UnlockBrush(FillBrushObj);
return TRUE;