DisplaySurface.st
changeset 4391 7f646ac1b1ea
parent 4291 85475200669d
child 4413 139a64d7cb9a
--- a/DisplaySurface.st	Tue Jun 07 18:28:21 2005 +0200
+++ b/DisplaySurface.st	Mon Jun 13 20:19:43 2005 +0200
@@ -105,7 +105,8 @@
     "return true, if the newRectangle is not already contained in the updateRegion
      (i.e. if it added any pixels to the region"
 
-    |closure|
+    |closure lastRect numRect lastTop lastBottom lastLeft lastRight 
+     newTop newBottom newLeft newRight|
 
     updateRegion isNil ifTrue:[
         updateRegion := OrderedCollection with:newRectangle.
@@ -115,7 +116,8 @@
         ^ false.
     ].
 
-    updateRegion size > 10 ifTrue:[
+    numRect := updateRegion size.
+    numRect > 10 ifTrue:[
         closure := updateRegion 
                         inject:newRectangle 
                         into:[:boundsSoFar :thisRectangle |
@@ -125,6 +127,37 @@
         ^ true
     ].
 
+    lastRect := updateRegion at:numRect.
+    lastTop := lastRect top.
+    lastBottom := lastRect bottom.
+    lastLeft := lastRect left.
+    lastRight := lastRect right.
+    newTop := newRectangle top.
+    newBottom := newRectangle bottom.
+    newLeft := newRectangle left.
+    newRight := newRectangle right.
+
+    lastTop = newTop ifTrue:[
+        lastBottom = newBottom ifTrue:[
+            lastLeft <= newLeft ifTrue:[
+                lastRight >= newLeft ifTrue:[
+                    lastRect right:newRight.
+                    ^ false "/ true
+                ]
+            ]
+        ].
+    ].
+    lastLeft = newLeft ifTrue:[
+        lastRight = newRight ifTrue:[
+            lastTop <= newTop ifTrue:[
+                lastBottom >= newTop ifTrue:[
+                    lastRect bottom:newBottom.
+                    ^ false "/ true
+                ]
+            ]
+        ].
+    ].
+
     updateRegion add:newRectangle.
     ^ true
 !
@@ -2452,7 +2485,7 @@
 !DisplaySurface class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.123 2004-09-27 14:07:41 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.124 2005-06-13 18:19:43 cg Exp $'
 ! !
 
 DisplaySurface initialize!