Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2006-01-12 21:50:48 +0300
committerSebastien Pouliot <sebastien@ximian.com>2006-01-12 21:50:48 +0300
commit3c6197c3d007caa1706c9f5bfeedd4215cbbe43f (patch)
tree19a97192a29f12f0d6166571f2ca459ccbc713d0 /mcs/class/System.Drawing/System.Drawing.Drawing2D
parent0904346d1a47fbc888bb28d68689bb7516e489a2 (diff)
2006-01-12 Sebastien Pouliot <sebastien@ximian.com>
* GraphicsPath.cs: Throw an ArgumentException if either PathPoints or PathTypes properties are empty (0 length). Note that PathData property still works in that case. * PathData.cs: Don't clone empty arrays (results in NRE). svn path=/trunk/mcs/; revision=55444
Diffstat (limited to 'mcs/class/System.Drawing/System.Drawing.Drawing2D')
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog7
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs31
3 files changed, 42 insertions, 16 deletions
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
index 97eb9710369..fbdcc38bcd7 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
@@ -1,3 +1,10 @@
+2006-01-12 Sebastien Pouliot <sebastien@ximian.com>
+
+ * GraphicsPath.cs: Throw an ArgumentException if either PathPoints or
+ PathTypes properties are empty (0 length). Note that PathData property
+ still works in that case.
+ * PathData.cs: Don't clone empty arrays (results in NRE).
+
2005-11-13 Konstantin Triger <kostat@mainsoft.com>
* GraphicsPath.jvm.cs: AddString support.
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs
index 02bd41d9812..78b23029aa4 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs
@@ -146,9 +146,21 @@ namespace System.Drawing.Drawing2D
public PathData PathData {
get {
+ int count;
+ Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
+ GDIPlus.CheckStatus (status);
+
+ PointF [] points = new PointF [count];
+ status = GDIPlus.GdipGetPathPoints (nativePath, points, count);
+ GDIPlus.CheckStatus (status);
+
+ byte [] types = new byte [count];
+ status = GDIPlus.GdipGetPathTypes (nativePath, types, count);
+ GDIPlus.CheckStatus (status);
+
PathData pdata = new PathData ();
- pdata.Points = PathPoints;
- pdata.Types = PathTypes;
+ pdata.Points = points;
+ pdata.Types = types;
return pdata;
}
}
@@ -158,6 +170,8 @@ namespace System.Drawing.Drawing2D
int count;
Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
GDIPlus.CheckStatus (status);
+ if (count == 0)
+ throw new ArgumentException ("PathPoints");
PointF [] points = new PointF [count];
status = GDIPlus.GdipGetPathPoints (nativePath, points, count);
@@ -172,6 +186,8 @@ namespace System.Drawing.Drawing2D
int count;
Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
GDIPlus.CheckStatus (status);
+ if (count == 0)
+ throw new ArgumentException ("PathTypes");
byte [] types = new byte [count];
status = GDIPlus.GdipGetPathTypes (nativePath, types, count);
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs
index cbb0d32fef2..f76be5dd3f0 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs
@@ -4,12 +4,10 @@
// Authors:
// Dennis Hayes (dennish@Raytek.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002/3 Ximian, Inc
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -31,27 +29,32 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System;
-
namespace System.Drawing.Drawing2D
{
- /// <summary>
- /// Summary description for PathData.
- /// </summary>
public sealed class PathData
{
- private PointF[] points = null;
- private byte[] types = null;
+ private PointF[] points;
+ private byte[] types;
- public PathData () { }
+ public PathData ()
+ {
+ }
public PointF[] Points {
- get { return (PointF[]) points.Clone (); }
+ get {
+ if (points == null)
+ return null;
+ return (PointF[]) points.Clone ();
+ }
set { points = value; }
}
public byte[] Types {
- get { return (byte[]) types.Clone (); }
+ get {
+ if (types == null)
+ return null;
+ return (byte[]) types.Clone ();
+ }
set { types = value; }
}