Parcourir la source

2005-06-08 Jordi Mas i Hernandez <[email protected]> <[email protected]>

	* Rectangle.cs:
		- Fixes is empty method IsEmpty logic
		- Fixes Contains method logic
		- Fixes IntersectsWith logic
		
	* RectangleF.cs:
		- Fixes is empty method IsEmpty logic
		- Fixes Contains method logic
		- Fixes IntersectsWith logic



svn path=/trunk/mcs/; revision=45642
Jordi Mas i Hernandez il y a 20 ans
Parent
commit
032d9d15dc

+ 13 - 0
mcs/class/System.Drawing/System.Drawing/ChangeLog

@@ -1,3 +1,16 @@
+2005-06-08 Jordi Mas i Hernandez <[email protected]> <[email protected]>
+
+	* Rectangle.cs:
+		- Fixes is empty method IsEmpty logic
+		- Fixes Contains method logic
+		- Fixes IntersectsWith logic
+		
+	* RectangleF.cs:
+		- Fixes is empty method IsEmpty logic
+		- Fixes Contains method logic
+		- Fixes IntersectsWith logic
+
+
 2005-05-28  Kornél Pál <[email protected]>
 
 	* ComIStreamMarshaler.cs: GC.SuppressFinalize(this) is not called in

+ 6 - 10
mcs/class/System.Drawing/System.Drawing/Rectangle.cs

@@ -352,15 +352,11 @@ namespace System.Drawing
 		///
 		/// <remarks>
 		///	Indicates if the width or height are zero. Read only.
-		/// </remarks>
-		// LAMESPEC: Documentation says "This property returns true if 
-		// the Width, Height, X, and Y properties of this RectangleF all 
-		// have values of zero; otherwise, false.". Reality returns TRUE if
-		// width or height are equal 0		
+		/// </remarks>		
 		[Browsable (false)]
 		public bool IsEmpty {
 			get {
-				return ((width == 0) || (height == 0));
+				return ((x == 0) && (y == 0) && (width == 0) && (height == 0));
 			}
 		}
 
@@ -511,8 +507,8 @@ namespace System.Drawing
 		
 		public bool Contains (int x, int y)
 		{
-			return ((x >= Left) && (x <= Right) && 
-				(y >= Top) && (y <= Bottom));
+			return ((x >= Left) && (x < Right) && 
+				(y >= Top) && (y < Bottom));
 		}
 
 		/// <summary>
@@ -581,8 +577,8 @@ namespace System.Drawing
 		
 		public bool IntersectsWith (Rectangle r)
 		{
-			return !((Left > r.Right) || (Right < r.Left) ||
-			    (Top > r.Bottom) || (Bottom < r.Top));
+			return !((Left >= r.Right) || (Right <= r.Left) ||
+			    (Top >= r.Bottom) || (Bottom <= r.Top));
 		}
 
 		/// <summary>

+ 6 - 11
mcs/class/System.Drawing/System.Drawing/RectangleF.cs

@@ -296,16 +296,11 @@ namespace System.Drawing
 		/// <remarks>
 		///	Indicates if the width or height are zero. Read only.
 		/// </remarks>
-		//
-		// LAMESPEC: Documentation says "This property returns true if 
-		// the Width, Height, X, and Y properties of this RectangleF all 
-		// have values of zero; otherwise, false.". Reality returns TRUE if
-		// width or height are equal 0		
-		
+		//		
 		[Browsable (false)]
 		public bool IsEmpty {
 			get {
-				return ((width == 0) || (height == 0));
+				return ((x == 0) && (y == 0) && (width == 0) && (height == 0));
 			}
 		}
 
@@ -456,8 +451,8 @@ namespace System.Drawing
 		
 		public bool Contains (float x, float y)
 		{
-			return ((x >= Left) && (x <= Right) && 
-				(y >= Top) && (y <= Bottom));
+			return ((x >= Left) && (x < Right) && 
+				(y >= Top) && (y < Bottom));
 		}
 
 		/// <summary>
@@ -526,8 +521,8 @@ namespace System.Drawing
 
 		public bool IntersectsWith (RectangleF r)
 		{
-			return !((Left > r.Right) || (Right < r.Left) ||
-			    (Top > r.Bottom) || (Bottom < r.Top));
+			return !((Left >= r.Right) || (Right <= r.Left) ||
+			    (Top >= r.Bottom) || (Bottom <= r.Top));
 		}
 
 		/// <summary>