2003/12/27 01:03:55
[org.ibex.core.git] / src / org / xwt / plat / AWT.java
index 0951f8f..6a907e8 100644 (file)
@@ -22,9 +22,8 @@ public class AWT extends JVM {
     protected Surface _createSurface(Box b, boolean framed) { return new AWTSurface(b, framed); }
 
     protected void postInit() {
-        System.setProperty("com.apple.mrj.application.live-resize", "true");
-        System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
-        if (Log.on) Log.log(Platform.class, "               color depth = " + Toolkit.getDefaultToolkit().getColorModel().getPixelSize() + "bpp");
+        if (Log.on) Log.log(Platform.class, "               color depth = " +
+                            Toolkit.getDefaultToolkit().getColorModel().getPixelSize() + "bpp");
     }
 
     protected void _criticalAbort(String message) {
@@ -141,7 +140,6 @@ public class AWT extends JVM {
     }
 
     protected static class AWTPicture extends Picture {
-        int[] data = null;
         public Image i = null;
         private static ColorModel cmodel = new DirectColorModel(32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
         
@@ -240,9 +238,8 @@ public class AWT extends JVM {
         implements MouseListener, MouseMotionListener, KeyListener, ComponentListener, WindowListener {
 
         public void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2) {
-            if (ourGraphics == null) ourGraphics = window.getGraphics();
             insets = (frame == null ? window : frame).getInsets();
-            ourGraphics.drawImage(((AWTPixelBuffer)s).i,
+            window.getGraphics().drawImage(((AWTPixelBuffer)s).i,
                                   dx + insets.left,
                                   dy + insets.top,
                                   dx2 + insets.left,
@@ -257,9 +254,6 @@ public class AWT extends JVM {
         /** our component's insets */
         protected Insets insets = new Insets(0, 0, 0, 0);
         
-        /** a Graphics context on <code>window</code> */
-        protected Graphics ourGraphics = null;
-        
         /** some JDKs let us recycle a single Dimension object when calling getSize() */
         Dimension singleSize = new Dimension();
         
@@ -290,7 +284,8 @@ public class AWT extends JVM {
                 int newwidth = Math.max(r.x - insets.left + r.width, root.width);
                 int newheight = Math.max(r.y - insets.top + r.height, root.height);
                 if (newwidth > root.width || newheight > root.height)
-                    componentResized(window.getWidth() - insets.left - insets.right, window.getHeight() - insets.top - insets.bottom);
+                    componentResized(window.getWidth() - insets.left - insets.right,
+                                     window.getHeight() - insets.top - insets.bottom);
 
                 Dirty(r.x - insets.left, r.y - insets.top, r.width, r.height);
             }
@@ -305,9 +300,18 @@ public class AWT extends JVM {
             }
         }
 
+        public void render() {
+            // useful optimizatin;
+            window.setBackground((root.fillcolor & 0xFF000000) == 0 ?
+                                 Color.white :
+                                 new Color((root.fillcolor >> 16) & 0xff,
+                                           (root.fillcolor >> 8) & 0xff,
+                                           (root.fillcolor) & 0xff));
+            super.render();
+        }
+
         AWTSurface(Box root, boolean framed) {
             super(root);
-            System.out.println("Y");
             try {
                 if (framed) window = frame = new InnerFrame();
                 else window = new InnerWindow();
@@ -392,12 +396,6 @@ public class AWT extends JVM {
             int oldwidth = root.width;
             int oldheight = root.height;
             SizeChange(newwidth, newheight);
-
-            // we do this because JVMs which don't clear the background won't force repaints of these areas
-            root.dirty(Math.min(oldwidth, newwidth), 0, Math.abs(oldwidth - newwidth), Math.max(oldheight, newheight));
-            root.dirty(0, Math.min(oldheight, newheight), Math.max(oldwidth, newwidth), Math.abs(oldheight - newheight));
-
-            ourGraphics = null;
         }
 
         public void keyTyped(KeyEvent k) { }