2003/10/21 21:25:35
[org.ibex.core.git] / src / org / xwt / Surface.java
index 089480e..3f29808 100644 (file)
@@ -223,15 +223,16 @@ public abstract class Surface extends PixelBuffer {
         Message.Q.add(new Message() { public void perform() {
             if (width == root.width && height == root.height) return;
             root.needs_reflow = true;
-            root.reflow(width, height);
+            do { abort = false; root.reflow(width, height); } while(abort);
         }});
         abort = true;
     }
 
     protected final void PosChange(final int x, final int y) {
         Message.Q.add(new Message() { public void perform() {
-            root.put("x", new Integer(x));
-            root.put("y", new Integer(y));
+            root.x = x;
+            root.y = y;
+            root.put("PosChange", Boolean.TRUE);
         }});
     }
 
@@ -284,6 +285,8 @@ public abstract class Surface extends PixelBuffer {
         Refresh();
     }
 
+    private static VectorGraphics.Affine identity = VectorGraphics.Affine.identity();
+
     /** runs the prerender() and render() pipelines in the root Box to regenerate the backbuffer, then blits it to the screen */
     public synchronized void render() {
 
@@ -291,6 +294,7 @@ public abstract class Surface extends PixelBuffer {
         do {
             abort = false;
             root.reflow();
+            setSize();
             // update mouseinside and trigger Enter/Leave as a result of box size/position changes
             String oldcursor = cursor;
             cursor = "default";
@@ -309,7 +313,7 @@ public abstract class Surface extends PixelBuffer {
             if (y+h > root.height) h = root.height - y;
             if (w <= 0 || h <= 0) continue;
 
-            root.render(0, 0, x, y, w, h, this);
+            root.render(0, 0, x, y, w, h, this, identity);
             
             if (abort) {
 
@@ -326,7 +330,6 @@ public abstract class Surface extends PixelBuffer {
                 return;
             }
         }
-
     }
 
     // FEATURE: reinstate recycler
@@ -361,12 +364,23 @@ public abstract class Surface extends PixelBuffer {
             screenDirtyRegions.dirty(dx1, dy1, dx2 - dx1, dy2 - dy1);
             backbuffer.drawPicture(source, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2); }
 
-        public void fillRect(int x1, int y1, int x2, int y2, int color) {
-            screenDirtyRegions.dirty(x1, y1, x2 - x1, y2 - y1);
-            backbuffer.fillRect(x1, y1, x2, y2, color); }
+        public void drawPictureAlphaOnly(Picture source,
+                                         int dx1, int dy1, int dx2, int dy2,
+                                         int sx1, int sy1, int sx2, int sy2,
+                                         int argb) {
+            screenDirtyRegions.dirty(dx1, dy1, dx2 - dx1, dy2 - dy1);
+            backbuffer.drawPictureAlphaOnly(source, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, argb); }
+
+        public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color) {
+            screenDirtyRegions.dirty(Math.min(x1, x3), y1, Math.max(x2, x4) - Math.min(x1, x3), y2 - y1);
+            backbuffer.fillTrapezoid(x1, x2, y1, x3, x4, y2, color); }
 
         public void render() {
             super.render();
+            render_();
+        }
+
+        public void render_() {
             int[][] dirt = screenDirtyRegions.flush();
             for(int i = 0; dirt != null && i < dirt.length; i++) {
                 if (dirt[i] == null) continue;