Author: spouliot
Date: 2006-10-11 22:01:10 -0400 (Wed, 11 Oct 2006)
New Revision: 66590
Modified:
trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs
trunk/mcs/class/System.Drawing/System.Drawing/StringFormat.cs
Log:
2006-10-11 Sebastien Pouliot <[EMAIL PROTECTED]>
* Graphics.cs: In MeasureCharacterRanges throw an ArgumentException if
StringFormat is null and return an empty region array if no range
exists
(avoid GDI+ error/exeception). In MeasureString (2 overloads) replace
999999 by Int32.MaxValue (now that the real bug is fixed).
* StringFormat.cs: Ensure we are clearing the handle before throwing
any exception.
Modified: trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog 2006-10-12
02:00:54 UTC (rev 66589)
+++ trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog 2006-10-12
02:01:10 UTC (rev 66590)
@@ -1,3 +1,12 @@
+2006-10-11 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * Graphics.cs: In MeasureCharacterRanges throw an ArgumentException if
+ StringFormat is null and return an empty region array if no range
exists
+ (avoid GDI+ error/exeception). In MeasureString (2 overloads) replace
+ 999999 by Int32.MaxValue (now that the real bug is fixed).
+ * StringFormat.cs: Ensure we are clearing the handle before throwing
+ any exception.
+
2006-09-21 Sebastien Pouliot <[EMAIL PROTECTED]>
* gdipFunctions.cs: Throw an OverflowException for the ValueOverflow
Modified: trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs 2006-10-12
02:00:54 UTC (rev 66589)
+++ trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs 2006-10-12
02:01:10 UTC (rev 66590)
@@ -5,11 +5,11 @@
// Gonzalo Paniagua Javier ([EMAIL PROTECTED]) (stubbed out)
// Alexandre Pigolkine([EMAIL PROTECTED])
// Jordi Mas i Hernandez ([EMAIL PROTECTED])
+// Sebastien Pouliot <[EMAIL PROTECTED]>
//
// Copyright (C) 2003 Ximian, Inc. (http://www.ximian.com)
+// Copyright (C) 2004-2006 Novell, Inc. (http://www.novell.com)
//
-// Copyright (C) 2004-2005 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
// "Software"), to deal in the Software without restriction, including
@@ -1884,9 +1884,12 @@
throw new ArgumentNullException ("font");
if (stringFormat == null)
- stringFormat = StringFormat.GenericDefault;
+ throw new ArgumentException ("stringFormat");
int regcount =
stringFormat.GetMeasurableCharacterRangeCount ();
+ if (regcount == 0)
+ return new Region[0];
+
IntPtr[] native_regions = new IntPtr [regcount];
Region[] regions = new Region [regcount];
@@ -1940,7 +1943,7 @@
throw new ArgumentNullException ("font");
RectangleF boundingBox = new RectangleF ();
- RectangleF rect = new RectangleF (0, 0, width, 999999);
+ RectangleF rect = new RectangleF (0, 0, width,
Int32.MaxValue);
int charactersFitted, linesFilled;
Status status = GDIPlus.GdipMeasureString
(nativeObject, text, text.Length,
@@ -1965,7 +1968,7 @@
public SizeF MeasureString (string text, Font font, int width,
StringFormat format)
{
int charactersFitted, linesFilled;
- return MeasureString (text, font, new SizeF (width,
999999),
+ return MeasureString (text, font, new SizeF (width,
Int32.MaxValue),
format, out charactersFitted, out
linesFilled);
}
Modified: trunk/mcs/class/System.Drawing/System.Drawing/StringFormat.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/StringFormat.cs
2006-10-12 02:00:54 UTC (rev 66589)
+++ trunk/mcs/class/System.Drawing/System.Drawing/StringFormat.cs
2006-10-12 02:01:10 UTC (rev 66590)
@@ -70,9 +70,8 @@
{
if (nativeStrFmt != IntPtr.Zero) {
Status status = GDIPlus.GdipDeleteStringFormat
(nativeStrFmt);
- GDIPlus.CheckStatus (status);
-
nativeStrFmt = IntPtr.Zero;
+ GDIPlus.CheckStatus (status);
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches