massive reworking of Box.java
[org.ibex.core.git] / src / org / ibex / graphics / Surface.java
index 0f29914..165207f 100644 (file)
@@ -173,14 +173,15 @@ public abstract class Surface implements Callable {
         pendingHeight = height;
         syncRootBoxToSurface = true;
         abort = true;
-        Platform.Scheduler.renderAll();
+        Refresh();
     }
 
     // FEATURE: can we avoid creating objects here?
     protected final void PosChange(final int x, final int y) {
         Platform.Scheduler.add(new Callable() { public Object run(Object o) throws JSExn {
-            root.x = x;
-            root.y = y;
+            // FIXME
+            //root.x = x;
+            //root.y = y;
             root.putAndTriggerTrapsAndCatchExceptions(JSU.S("PosChange"), T);
             return null;
         }});
@@ -258,7 +259,6 @@ public abstract class Surface implements Callable {
         // make sure the root is properly sized
         do {
             abort = false;
-            root.pack();
             if (syncRootBoxToSurface) {
                 root.setWidth(root.minwidth, pendingWidth);
                 root.setHeight(root.minheight, pendingHeight);
@@ -280,6 +280,7 @@ public abstract class Surface implements Callable {
         } while(abort);
 
         int[][] dirt = dirtyRegions.flush();
+
         for(int i = 0; dirt != null && i < dirt.length; i++) {
             if (dirt[i] == null) continue;
             int x = dirt[i][0], y = dirt[i][1], w = dirt[i][2], h = dirt[i][3];
@@ -289,7 +290,7 @@ public abstract class Surface implements Callable {
             if (y+h > root.height) h = root.height - y;
             if (w <= 0 || h <= 0) continue;
 
-            root.render(0, 0, x, y, x + w, y + h, this.getPixelBuffer(), identity);
+            root.render(x, y, x + w, y + h, this.getPixelBuffer(), identity);
             getPixelBuffer().drawPicture(scarImage, 0, root.height - scarImage.height, x, y, x+w, y+h);
             
             if (abort) {
@@ -412,8 +413,9 @@ public abstract class Surface implements Callable {
 
         // This is how subclasses signal a 'shallow dirty', indicating that although the backbuffer is valid, the screen is not
         public final void Dirty(int x, int y, int w, int h) {
-            screenDirtyRegions.dirty(x, y, w, h);
-            Platform.Scheduler.renderAll();
+            //screenDirtyRegions.dirty(x, y, w, h);
+            //Refresh();
+            blit(x,y,w,h);
         }
 
         public void dirty(int x, int y, int w, int h) {