Fix drawing pie fill aligment.
authorJames Tabor <james.tabor@reactos.org>
Mon, 30 Jun 2008 05:11:39 +0000 (05:11 +0000)
committerJames Tabor <james.tabor@reactos.org>
Mon, 30 Jun 2008 05:11:39 +0000 (05:11 +0000)
svn path=/trunk/; revision=34207

reactos/subsystems/win32/win32k/objects/arc.c
reactos/subsystems/win32/win32k/objects/drawing.c

index 3138e25..c0eed68 100644 (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);
index 14fa7dd..35f881c 100755 (executable)
@@ -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;