From 3e2edeb4ccfc4c3efee216042828bec2997b1210 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Thu, 27 Apr 2006 18:37:51 +0000 Subject: [PATCH] 2006-04-27 Sebastien Pouliot * GraphicsPath.cs: Re-write two versions of AddLines method to use GdipAddPathLine2[I] functions. This fix a unit test where we can add a single point with those methods. It also prevent multiple managed to unmanaged transitions. svn path=/trunk/mcs/; revision=60003 --- .../System.Drawing.Drawing2D/ChangeLog | 7 +++++ .../System.Drawing.Drawing2D/GraphicsPath.cs | 31 ++++++------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog index 98573a531cd..11ddf3976fb 100644 --- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog +++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog @@ -1,3 +1,10 @@ +2006-04-27 Sebastien Pouliot + + * GraphicsPath.cs: Re-write two versions of AddLines method to use + GdipAddPathLine2[I] functions. This fix a unit test where we can add + a single point with those methods. It also prevent multiple managed to + unmanaged transitions. + 2006-04-27 Sebastien Pouliot * GraphicsPath.cs: Fix exception handle in AddString methods to match diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs index 9ced5ac087b..d35589de992 100644 --- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs +++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs @@ -352,38 +352,27 @@ namespace System.Drawing.Drawing2D // // AddLines // - public void AddLines (Point [] points) - { + public void AddLines (Point[] points) + { if (points == null) throw new ArgumentNullException ("points"); if (points.Length == 0) throw new ArgumentException ("points"); - int length = points.Length; - for (int i = 0; i < length - 1; i++) { - int j = i + 1; - Status status = GDIPlus.GdipAddPathLineI ( - nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y); - GDIPlus.CheckStatus (status); - } - } + Status status = GDIPlus.GdipAddPathLine2I (nativePath, points, points.Length); + GDIPlus.CheckStatus (status); + } - public void AddLines (PointF [] points) - { + public void AddLines (PointF[] points) + { if (points == null) throw new ArgumentNullException ("points"); if (points.Length == 0) throw new ArgumentException ("points"); - int length = points.Length; - - for (int i = 0; i < length - 1; i++) { - int j = i + 1; - Status status = GDIPlus.GdipAddPathLine ( - nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y); - GDIPlus.CheckStatus (status); - } - } + Status status = GDIPlus.GdipAddPathLine2 (nativePath, points, points.Length); + GDIPlus.CheckStatus (status); + } // // AddPie -- 2.25.1