incremental repainting
authoradam <adam@megacz.com>
Sun, 11 Apr 2004 19:56:22 +0000 (19:56 +0000)
committeradam <adam@megacz.com>
Sun, 11 Apr 2004 19:56:22 +0000 (19:56 +0000)
darcs-hash:20040411195622-5007d-da1de8fa4228eccf4a4bb52187e46ee3227e1d84.gz

src/org/ibex/Box.java

index faaabeb..9d2196d 100644 (file)
@@ -254,25 +254,22 @@ public final class Box extends JSScope implements Scheduler.Task {
     void resize(LENGTH x, LENGTH y, LENGTH width, LENGTH height) {
         if (x == this.x && y == this.y && width == this.width && height == this.height) return;
         boolean sizechange = (this.width != width || this.height != height) && getTrap("SizeChange") != null;
-        try {
-            int thisx = parent == null ? 0 : this.x;
-            int thisy = parent == null ? 0 : this.y;
-            if (this.x != x || this.y != y) set(MOVED);
-            if (texture == null && (text == null || text.equals("")) && !test(MOVED)) {
-                if ((fillcolor & 0xff000000) != 0) {
-                    Box who = (parent == null ? this : parent);
-                    who.dirty(thisx+min(this.width,width), thisy, Math.abs(width-this.width), max(this.height, height));
-                    who.dirty(thisx, thisy+min(this.height,height), min(this.width, width), Math.abs(height-this.height));
-                }
-                //return;
+        int thisx = parent == null ? 0 : this.x;
+        int thisy = parent == null ? 0 : this.y;
+        Box who = (parent == null ? this : parent);
+        if (this.x != x || this.y != y) set(MOVED);
+        if (texture == null && (text == null || text.equals("")) && !test(MOVED)) {
+            if ((fillcolor & 0xff000000) != 0 || parent == null) {
+                who.dirty(thisx+min(this.width,width), thisy, Math.abs(width-this.width), max(this.height, height));
+                who.dirty(thisx, thisy+min(this.height,height), max(this.width, width), Math.abs(height-this.height));
             }
-            (parent == null ? this : parent).dirty(thisx, thisy, this.width, this.height);
             this.width = width; this.height = height; this.x = x; this.y = y;
-            DIRTY;
-        } finally {
+        } else {
+            who.dirty(thisx, thisy, this.width, this.height);
             this.width = width; this.height = height; this.x = x; this.y = y;
-            if (sizechange) putAndTriggerTrapsAndCatchExceptions("SizeChange", T);
+            DIRTY;
         }
+        if (sizechange) putAndTriggerTrapsAndCatchExceptions("SizeChange", T);
     }
 
     private float targetColumnSize = (float)0.0;