Rectangle.st
changeset 8884 c864e1e7d7f7
parent 8076 de72537a061e
child 11743 49253690b8bd
--- a/Rectangle.st	Thu Jun 02 16:03:08 2005 +0200
+++ b/Rectangle.st	Mon Jun 13 20:35:27 2005 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -1433,11 +1431,12 @@
 quickMerge: aRectangle 
     "return the receiver if it encloses the given rectangle,
      or the merge of the two rectangles if it doesn't. 
-     This method is an optimization to reduce extra rectangle creations."
+     This method is an optimized version of merge: to reduce extra rectangle creations."
 
     | useRcvr rLeft rTop rRight rBottom minX maxX minY maxY |
 
     useRcvr := true.
+
     rLeft := aRectangle left.
     rTop := aRectangle top.
     rRight := aRectangle right.
@@ -1452,7 +1451,19 @@
     maxY := self bottom.
     rBottom > maxY ifTrue: [useRcvr := false. maxY := rBottom].
 
-    useRcvr ifTrue: [^ self].
+    useRcvr ifTrue: [
+        ^ self
+    ].
+
+    minX = rLeft ifTrue:[
+        maxX = rRight ifTrue:[
+            minY = rTop ifTrue:[
+                maxY = rBottom ifTrue:[
+                    ^ aRectangle
+                ].
+            ].
+        ].
+    ].
 
     ^ Rectangle left:minX top:minY right:maxX bottom:maxY.
 
@@ -1789,5 +1800,5 @@
 !Rectangle class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.81 2004-03-05 12:42:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.82 2005-06-13 18:35:27 cg Exp $'
 ! !