From 75af9256fbb30436a3750ba195c60ba8462951c1 Mon Sep 17 00:00:00 2001 From: Ben Maurer Date: Tue, 15 Nov 2005 23:42:05 +0000 Subject: [PATCH] 2005-11-15 Ben Maurer * gdk/Rectangle.custom: Fix up Intersect using p/invoke, per miguel's request. svn path=/trunk/gtk-sharp/; revision=53095 --- ChangeLog | 5 +++++ gdk/Rectangle.custom | 18 +++++------------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 016239295..9668b8ad5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-11-15 Ben Maurer + + * gdk/Rectangle.custom: Fix up Intersect using p/invoke, per + miguel's request. + 2005-11-10 Mike Kestner * bootstrap-2.6 - renamed from bootstrap diff --git a/gdk/Rectangle.custom b/gdk/Rectangle.custom index 955fdd23e..143d22c03 100644 --- a/gdk/Rectangle.custom +++ b/gdk/Rectangle.custom @@ -104,23 +104,15 @@ public static Rectangle Union (Rectangle r1, Rectangle r2) public void Intersect (Rectangle 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 = Intersect (this, r); } public static Rectangle Intersect (Rectangle r1, Rectangle r2) { - Rectangle r = r1; - r.Intersect (r2); + Rectangle r; + if (!r1.Intersect (r2, out r)) + return new Rectangle (); + return r; }