avoid 2 sends if possible
authorClaus Gittinger <cg@exept.de>
Thu, 06 Mar 1997 22:40:12 +0100
changeset 498 a9f922ab2050
parent 497 6544ec670fe0
child 499 58852715e10d
avoid 2 sends if possible
LayoutFrame.st
LayoutFrm.st
--- a/LayoutFrame.st	Thu Mar 06 16:18:25 1997 +0100
+++ b/LayoutFrame.st	Thu Mar 06 22:40:12 1997 +0100
@@ -350,7 +350,7 @@
     "compute the rectangle represented by the receiver,
      given the superViews rectangle and the views preferredExtent."
 
-    |x1 y1 x2 y2|
+    |x1 y1 x2 y2 superWidth superHeight|
 
     leftOffset isNil ifTrue:[
         x1 := 0
@@ -372,24 +372,29 @@
     ] ifFalse:[
         y2 := bottomOffset
     ].
+
     leftFraction notNil ifTrue:[
-        x1 := x1 + (superRectangle width * leftFraction)
+        superWidth := superRectangle width.
+        x1 := x1 + (superWidth * leftFraction)
     ].
     topFraction notNil ifTrue:[
-        y1 := y1 + (superRectangle height * topFraction)
+        superHeight := superRectangle height.
+        y1 := y1 + (superHeight * topFraction)
     ].
     rightFraction notNil ifTrue:[
-        x2 := x2 + (superRectangle width * rightFraction)
+        superWidth isNil ifTrue:[superWidth := superRectangle width].
+        x2 := x2 + (superWidth * rightFraction)
     ].
     bottomFraction notNil ifTrue:[
-        y2 := y2 + (superRectangle height * bottomFraction)
+        superHeight isNil ifTrue:[superHeight := superRectangle height].
+        y2 := y2 + (superHeight * bottomFraction)
     ].
     ^ Rectangle left:x1 top:y1 right:x2 bottom:y2
 
     "
      |superRect lF|
 
-     superRect := 0@0 corner:100@100.
+     superRect := 0@0 corner:99@99.
      lF := (LayoutFrame new).
      lF leftFraction:0.25;
         topFraction:0.25;
@@ -398,11 +403,12 @@
      lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) 
     "
 
-    "Modified: 8.5.1996 / 20:50:45 / cg"
+    "Created: 6.3.1997 / 21:07:51 / cg"
+    "Modified: 6.3.1997 / 22:39:58 / cg"
 ! !
 
 !LayoutFrame class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/LayoutFrame.st,v 1.19 1997-03-01 16:27:29 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/LayoutFrame.st,v 1.20 1997-03-06 21:40:12 cg Exp $'
 ! !
--- a/LayoutFrm.st	Thu Mar 06 16:18:25 1997 +0100
+++ b/LayoutFrm.st	Thu Mar 06 22:40:12 1997 +0100
@@ -350,7 +350,7 @@
     "compute the rectangle represented by the receiver,
      given the superViews rectangle and the views preferredExtent."
 
-    |x1 y1 x2 y2|
+    |x1 y1 x2 y2 superWidth superHeight|
 
     leftOffset isNil ifTrue:[
         x1 := 0
@@ -372,24 +372,29 @@
     ] ifFalse:[
         y2 := bottomOffset
     ].
+
     leftFraction notNil ifTrue:[
-        x1 := x1 + (superRectangle width * leftFraction)
+        superWidth := superRectangle width.
+        x1 := x1 + (superWidth * leftFraction)
     ].
     topFraction notNil ifTrue:[
-        y1 := y1 + (superRectangle height * topFraction)
+        superHeight := superRectangle height.
+        y1 := y1 + (superHeight * topFraction)
     ].
     rightFraction notNil ifTrue:[
-        x2 := x2 + (superRectangle width * rightFraction)
+        superWidth isNil ifTrue:[superWidth := superRectangle width].
+        x2 := x2 + (superWidth * rightFraction)
     ].
     bottomFraction notNil ifTrue:[
-        y2 := y2 + (superRectangle height * bottomFraction)
+        superHeight isNil ifTrue:[superHeight := superRectangle height].
+        y2 := y2 + (superHeight * bottomFraction)
     ].
     ^ Rectangle left:x1 top:y1 right:x2 bottom:y2
 
     "
      |superRect lF|
 
-     superRect := 0@0 corner:100@100.
+     superRect := 0@0 corner:99@99.
      lF := (LayoutFrame new).
      lF leftFraction:0.25;
         topFraction:0.25;
@@ -398,11 +403,12 @@
      lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) 
     "
 
-    "Modified: 8.5.1996 / 20:50:45 / cg"
+    "Created: 6.3.1997 / 21:07:51 / cg"
+    "Modified: 6.3.1997 / 22:39:58 / cg"
 ! !
 
 !LayoutFrame class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.19 1997-03-01 16:27:29 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.20 1997-03-06 21:40:12 cg Exp $'
 ! !