text transform, headless session
[mono.git] / mcs / class / System.Drawing / System.Drawing / RectangleF.cs
index 2240a8ca05d665514135ca348c484b1a8e4a59cc..3d34b67efdc7060f886c10fd535e1c87fa0966d3 100644 (file)
@@ -51,6 +51,13 @@ namespace System.Drawing
                
                public static readonly RectangleF Empty;
 
+#if TARGET_JVM
+               internal java.awt.geom.Rectangle2D NativeObject {
+                       get {
+                               return new java.awt.geom.Rectangle2D.Float(X,Y,Width,Height);
+                       }
+               }
+#endif
 
                /// <summary>
                ///     FromLTRB Shared Method
@@ -94,10 +101,7 @@ namespace System.Drawing
                
                public void Inflate (float width, float height)
                {
-                        x -= width;
-                        y -= height;
-                        width += width * 2;
-                        height += height * 2;                        
+                       Inflate (new SizeF (width, height));
                }
 
                /// <summary>
@@ -110,7 +114,10 @@ namespace System.Drawing
                
                public void Inflate (SizeF sz)
                {
-                       Inflate (sz.Width, sz.Height);
+                        x -= sz.Width;
+                        y -= sz.Height;
+                        width += sz.Width * 2;
+                        height += sz.Height * 2;                        
                }
 
                /// <summary>
@@ -125,9 +132,14 @@ namespace System.Drawing
                public static RectangleF Intersect (RectangleF r1, 
                                                    RectangleF r2)
                {
-                       RectangleF r = new RectangleF (r1.X, r1.Y, r1.Width, r1.Height);
-                       r.Intersect (r2);
-                       return r;
+                       if (!r1.IntersectsWith (r2)) 
+                               return Empty;
+
+                       return FromLTRB (
+                               Math.Max (r1.Left, r2.Left),
+                               Math.Max (r1.Top, r2.Top),
+                               Math.Min (r1.Right, r2.Right),
+                               Math.Min (r1.Bottom, r2.Bottom));
                }
 
                /// <summary>
@@ -141,17 +153,7 @@ namespace System.Drawing
                
                public void Intersect (RectangleF r)
                {
-                       if (!IntersectsWith (r)) {
-                                x = 0;
-                                y = 0;
-                                width = 0;
-                                height = 0;
-                       }
-
-                       x = Math.Max (Left, r.Left);
-                       y = Math.Max (Top, r.Top);
-                       width = Math.Min (Right, r.Right) - X;
-                       height = Math.Min (Bottom, r.Bottom) - Y;
+                       this = RectangleF.Intersect (this, r);
                }
 
                /// <summary>
@@ -255,6 +257,14 @@ namespace System.Drawing
                }
 
 
+#if TARGET_JVM
+               internal RectangleF (java.awt.geom.RectangularShape r2d) {
+                       this.x = (float) r2d.getX ();
+                       this.y = (float) r2d.getY ();
+                       this.width = (float) r2d.getWidth ();
+                       this.height = (float) r2d.getHeight ();
+               }
+#endif
 
                /// <summary>
                ///     Bottom Property