Fix AddLines
authorKonstantin Triger <kostat@mono-cvs.ximian.com>
Mon, 8 Aug 2005 09:29:26 +0000 (09:29 -0000)
committerKonstantin Triger <kostat@mono-cvs.ximian.com>
Mon, 8 Aug 2005 09:29:26 +0000 (09:29 -0000)
svn path=/trunk/mcs/; revision=48111

mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.jvm.cs

index e25ebab83d8eb2ebfbf859055c0bb6fc93be1373..b9b6a7f0d1c10fafd76b07f40b704eec5678f9ee 100644 (file)
@@ -1,3 +1,7 @@
+2005-08-08 Konstantin Triger <kostat@mainsoft.com>
+
+        * GraphicsPath.cs: Fix AddLines
+
 2005-08-08 Konstantin Triger <kostat@mainsoft.com>
 
         * GraphicsPath.cs: Fix AddArc/AddPie
index 63fc75ee2f30e1f8644ebed8f8fa3e541b5bd6f3..a3ac39ce2e69362176030d94a74e542662c7f840 100755 (executable)
@@ -293,8 +293,18 @@ namespace System.Drawing.Drawing2D
                        if (points == null)\r
                                throw new ArgumentNullException("points");\r
 \r
-                       for (int i = 0; i < points.Length - 1; i += 1) \r
-                               AddLine(points[i].X, points [i].Y, points [i+1].X, points [i+1].Y);\r
+                       if (points.Length == 0)\r
+                               return;\r
+\r
+                       if (_isNewFigure)\r
+                               NativeObject.moveTo(points[0].X, points[0].Y);\r
+                       else\r
+                               NativeObject.lineTo(points[0].X, points[0].Y);\r
+\r
+                       _isNewFigure = false;\r
+\r
+                       for (int i = 1; i < points.Length; i ++)\r
+                               NativeObject.lineTo(points[i].X, points[i].Y);\r
                }\r
 \r
                public void AddLines (PointF [] points)\r
@@ -302,8 +312,18 @@ namespace System.Drawing.Drawing2D
                        if (points == null)\r
                                throw new ArgumentNullException("points");\r
 \r
-                       for (int i = 0; i < points.Length - 1; i += 1) \r
-                               AddLine(points[i].X, points [i].Y, points [i+1].X, points [i+1].Y);\r
+                       if (points.Length == 0)\r
+                               return;\r
+\r
+                       if (_isNewFigure)\r
+                               NativeObject.moveTo(points[0].X, points[0].Y);\r
+                       else\r
+                               NativeObject.lineTo(points[0].X, points[0].Y);\r
+\r
+                       _isNewFigure = false;\r
+\r
+                       for (int i = 1; i < points.Length; i ++)\r
+                               NativeObject.lineTo(points[i].X, points[i].Y);\r
                }\r
                #endregion\r
         \r