avoid sending #translation twice
authorClaus Gittinger <cg@exept.de>
Tue, 21 May 1996 21:09:26 +0200
changeset 704 fc3711e83946
parent 703 4324ab5e3630
child 705 e8acdd90a071
avoid sending #translation twice
SimpleView.st
--- a/SimpleView.st	Tue May 21 19:17:57 1996 +0200
+++ b/SimpleView.st	Tue May 21 21:09:26 1996 +0200
@@ -5637,54 +5637,57 @@
      ih    "{ Class:SmallInteger }"
      orgX  
      orgY  "{ Class:SmallInteger }"
-     newOrigin|
+     newOrigin t|
 
     hCont := self heightOfContents.
     transformation isNil ifTrue:[
-	orgY := orgX := 0
+        orgY := orgX := 0
     ] ifFalse:[
-	hCont := (transformation applyScaleY:hCont) rounded.
-	orgY := transformation translation y negated.
-	orgX := transformation translation x negated.
+        hCont := (transformation applyScaleY:hCont) rounded.
+        t := transformation translation.
+        orgY := t y negated.
+        orgX := t x negated.
     ].
 
     count := nPixels.
     ih := self innerHeight.
 
     ((orgY + nPixels + ih) > hCont) ifTrue:[
-	count := hCont - orgY - ih
+        count := hCont - orgY - ih
     ].
     (count <= 0) ifTrue:[^ self].
 
     self originWillChange.
     newOrigin := orgX @ (orgY + count).
     shown ifFalse:[
-	self setViewOrigin:newOrigin.
+        self setViewOrigin:newOrigin.
     ] ifTrue:[
-	m2 := margin * 2.
-	(count >= ih) ifTrue:[
-	    self setViewOrigin:newOrigin.
-	    self redrawDeviceX:margin y:margin
-			 width:(width - m2)
-			height:(height - m2).
-	] ifFalse:[
-	    h := height - m2 - count.
-	    w := self width.
-	    self catchExpose.
-	    self setViewOrigin:newOrigin.
-	    self copyFrom:self x:margin y:(count + margin)
-			     toX:margin y:margin
-			   width:w 
-			  height:h.
-
-	    self setInnerClip.
-	    self redrawDeviceX:margin y:(h + margin) 
-			 width:(width - m2) height:count.
-
-	    self waitForExpose.
-	]
+        m2 := margin * 2.
+        (count >= ih) ifTrue:[
+            self setViewOrigin:newOrigin.
+            self redrawDeviceX:margin y:margin
+                         width:(width - m2)
+                        height:(height - m2).
+        ] ifFalse:[
+            h := height - m2 - count.
+            w := self width.
+            self catchExpose.
+            self setViewOrigin:newOrigin.
+            self copyFrom:self x:margin y:(count + margin)
+                             toX:margin y:margin
+                           width:w 
+                          height:h.
+
+            self setInnerClip.
+            self redrawDeviceX:margin y:(h + margin) 
+                         width:(width - m2) height:count.
+
+            self waitForExpose.
+        ]
     ].
     self originChanged:(0 @ count).
+
+    "Modified: 21.5.1996 / 21:07:06 / cg"
 !
 
 scrollLeft:nPixels
@@ -5693,18 +5696,19 @@
     |count "{ Class:SmallInteger }"
      m2    "{ Class:SmallInteger }"
      h     "{ Class:SmallInteger }"
-     orgX orgY newOrigin|
+     orgX orgY newOrigin t|
 
     transformation isNil ifTrue:[
-	orgY := orgX := 0
+        orgY := orgX := 0
     ] ifFalse:[
-	orgY := transformation translation y negated.
-	orgX := transformation translation x negated.
+        t := transformation translation.
+        orgY := t y negated.
+        orgX := t x negated.
     ].
 
     count := nPixels.
     (count > orgX) ifTrue:[
-	count := orgX
+        count := orgX
     ].
     (count <= 0) ifTrue:[^ self].
 
@@ -5712,32 +5716,34 @@
     newOrigin := (orgX - count) @ orgY.
 
     shown ifFalse:[
-	self setViewOrigin:newOrigin.
+        self setViewOrigin:newOrigin.
     ] ifTrue:[
-	m2 := margin * 2.
-	(count >= self innerWidth) ifTrue:[
-	    self setViewOrigin:newOrigin.
-	    self redrawDeviceX:margin y:margin
-			 width:(width - m2)
-			height:(height - m2).
-	] ifFalse:[
-	    h := (height - m2).
-
-	    self catchExpose.
-	    self setViewOrigin:newOrigin.
-	    self copyFrom:self x:margin y:margin
-			     toX:(count + margin) y:margin
-			   width:(width - m2 - count) 
-			  height:h.
-
-	    self setInnerClip.
-	    self redrawDeviceX:margin y:margin
-			 width:count height:(height - m2).
-
-	    self waitForExpose.
-	]
+        m2 := margin * 2.
+        (count >= self innerWidth) ifTrue:[
+            self setViewOrigin:newOrigin.
+            self redrawDeviceX:margin y:margin
+                         width:(width - m2)
+                        height:(height - m2).
+        ] ifFalse:[
+            h := (height - m2).
+
+            self catchExpose.
+            self setViewOrigin:newOrigin.
+            self copyFrom:self x:margin y:margin
+                             toX:(count + margin) y:margin
+                           width:(width - m2 - count) 
+                          height:h.
+
+            self setInnerClip.
+            self redrawDeviceX:margin y:margin
+                         width:count height:(height - m2).
+
+            self waitForExpose.
+        ]
     ].
     self originChanged:(count negated @ 0).
+
+    "Modified: 21.5.1996 / 21:07:37 / cg"
 !
 
 scrollRight:nPixels
@@ -5748,22 +5754,23 @@
      h     "{ Class:SmallInteger }" 
      wCont 
      iw    "{ Class:SmallInteger }"
-     orgX orgY newOrigin|
+     orgX orgY newOrigin t|
 
     wCont := self widthOfContents.
     transformation isNil ifTrue:[
-	orgY := orgX := 0
+        orgY := orgX := 0
     ] ifFalse:[
-	wCont := (transformation applyScaleX:wCont) rounded.
-	orgY := transformation translation y negated.
-	orgX := transformation translation x negated.
+        wCont := (transformation applyScaleX:wCont) rounded.
+        t := transformation translation.
+        orgY := t y negated.
+        orgX := t x negated.
     ].
 
     count := nPixels.
     iw := self innerWidth.
 
     ((orgX + nPixels + iw) > wCont) ifTrue:[
-	count := wCont - orgX - iw
+        count := wCont - orgX - iw
     ].
     (count <= 0) ifTrue:[^ self].
 
@@ -5771,33 +5778,35 @@
     newOrigin := (orgX + count) @ orgY.
 
     shown ifFalse:[
-	self setViewOrigin:newOrigin.
+        self setViewOrigin:newOrigin.
     ] ifTrue:[
-	m2 := margin * 2.
-	(count >= iw) ifTrue:[
-	    self setViewOrigin:newOrigin.
-	    self redrawDeviceX:margin y:margin
-			 width:(width - m2)
-			height:(height - m2).
-	] ifFalse:[
-	    m2 := margin * 2.
-	    h := (height - m2).
-
-	    self catchExpose.
-	    self setViewOrigin:newOrigin.
-	    self copyFrom:self x:(count + margin) y:margin
-			     toX:margin y:margin
-			   width:(width - m2 - count) 
-			  height:h.
-
-	    self setInnerClip.
-	    self redrawDeviceX:(width - margin - count) y:margin 
-			 width:count height:(height - m2).
-
-	    self waitForExpose.
-	].
+        m2 := margin * 2.
+        (count >= iw) ifTrue:[
+            self setViewOrigin:newOrigin.
+            self redrawDeviceX:margin y:margin
+                         width:(width - m2)
+                        height:(height - m2).
+        ] ifFalse:[
+            m2 := margin * 2.
+            h := (height - m2).
+
+            self catchExpose.
+            self setViewOrigin:newOrigin.
+            self copyFrom:self x:(count + margin) y:margin
+                             toX:margin y:margin
+                           width:(width - m2 - count) 
+                          height:h.
+
+            self setInnerClip.
+            self redrawDeviceX:(width - margin - count) y:margin 
+                         width:count height:(height - m2).
+
+            self waitForExpose.
+        ].
     ].
     self originChanged:(count @ 0).
+
+    "Modified: 21.5.1996 / 21:07:52 / cg"
 !
 
 scrollTo:newOrigin 
@@ -5814,43 +5823,47 @@
      dY   "{ Class:SmallInteger }"
      m2   "{ Class:SmallInteger }"
      orgX "{ Class:SmallInteger }"
-     orgY "{ Class:SmallInteger }" |
+     orgY "{ Class:SmallInteger }" 
+     t|
 
     transformation isNil ifTrue:[
-	orgY := orgX := 0
+        orgY := orgX := 0
     ] ifFalse:[
-	orgY := transformation translation y negated.
-	orgX := transformation translation x negated
+        t := transformation translation.
+        orgY := t y negated.
+        orgX := t x negated.
     ].
     dX := newOrigin x - orgX.
     dY := newOrigin y - orgY.
     dX = 0 ifTrue:[
-	dY < 0 ifTrue:[
-	    ^ self scrollUp:(dY negated).
-	].
-	dY > 0 ifTrue:[
-	    ^ self scrollDown:dY.
-	].
-	^ self
+        dY < 0 ifTrue:[
+            ^ self scrollUp:(dY negated).
+        ].
+        dY > 0 ifTrue:[
+            ^ self scrollDown:dY.
+        ].
+        ^ self
     ].
     dY = 0 ifTrue:[
-	dX < 0 ifTrue:[
-	    ^ self scrollLeft:dX negated
-	].
-	dX > 0 ifTrue:[
-	    ^ self scrollRight:dX
-	].
+        dX < 0 ifTrue:[
+            ^ self scrollLeft:dX negated
+        ].
+        dX > 0 ifTrue:[
+            ^ self scrollRight:dX
+        ].
     ].
 
     self originWillChange.
     self setViewOrigin:newOrigin.
     shown ifTrue:[
-	m2 := margin * 2. "top & bottom margins"
-	self redrawDeviceX:margin y:margin
-		     width:(width - m2)
-		    height:(height - m2).
+        m2 := margin * 2. "top & bottom margins"
+        self redrawDeviceX:margin y:margin
+                     width:(width - m2)
+                    height:(height - m2).
     ].
     self originChanged:(dX @ dY).
+
+    "Modified: 21.5.1996 / 21:08:05 / cg"
 !
 
 scrollUp:nPixels
@@ -5862,18 +5875,19 @@
      h     "{ Class:SmallInteger }"
      orgX
      orgY  "{ Class:SmallInteger }"
-     newOrigin|
+     newOrigin t|
 
     transformation isNil ifTrue:[
-	orgY := orgX := 0
+        orgY := orgX := 0
     ] ifFalse:[
-	orgY := transformation translation y negated.
-	orgX := transformation translation x negated
+        t := transformation translation.
+        orgY := t y negated.
+        orgX := t x negated.
     ].
 
     count := nPixels.
     (count > orgY) ifTrue:[
-	count := orgY
+        count := orgY
     ].
     (count <= 0) ifTrue:[^ self].
 
@@ -5881,32 +5895,34 @@
     newOrigin := orgX @ (orgY - count).
 
     shown ifFalse:[
-	self setViewOrigin:newOrigin.
+        self setViewOrigin:newOrigin.
     ] ifTrue:[
-	m2 := margin * 2. "top & bottom margins"
-	(count >= self innerHeight) ifTrue:[
-	    self setViewOrigin:newOrigin.
-	    self redrawDeviceX:margin y:margin
-			 width:(width - m2)
-			height:(height - m2).
-	] ifFalse:[
-	    h := height - m2 - count.
-	    w := width.
-	    self catchExpose.
-	    self setViewOrigin:newOrigin.
-	    self copyFrom:self x:margin y:margin
-			     toX:margin y:(count + margin)
-			   width:w height:h.
-
-	    self setInnerClip.
-	    self redrawDeviceX:margin y:margin
-			 width:(width - m2)
-			height:count.
-
-	    self waitForExpose.
-	]
+        m2 := margin * 2. "top & bottom margins"
+        (count >= self innerHeight) ifTrue:[
+            self setViewOrigin:newOrigin.
+            self redrawDeviceX:margin y:margin
+                         width:(width - m2)
+                        height:(height - m2).
+        ] ifFalse:[
+            h := height - m2 - count.
+            w := width.
+            self catchExpose.
+            self setViewOrigin:newOrigin.
+            self copyFrom:self x:margin y:margin
+                             toX:margin y:(count + margin)
+                           width:w height:h.
+
+            self setInnerClip.
+            self redrawDeviceX:margin y:margin
+                         width:(width - m2)
+                        height:count.
+
+            self waitForExpose.
+        ]
     ].
     self originChanged:(0 @ count negated).
+
+    "Modified: 21.5.1996 / 21:08:19 / cg"
 ! !
 
 !SimpleView methodsFor:'startup'!
@@ -6320,6 +6336,6 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.90 1996-05-18 15:34:29 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.91 1996-05-21 19:09:26 cg Exp $'
 ! !
 SimpleView initialize!