2003/12/27 01:03:55
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:43:21 +0000 (07:43 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:43:21 +0000 (07:43 +0000)
darcs-hash:20040130074321-2ba56-d78805ec1ee0f9b0dd5bb060ba5cc11dd204ba1c.gz

src/org/xwt/plat/AWT.java
src/org/xwt/plat/Darwin.java

index c63e9a7..6a907e8 100644 (file)
@@ -238,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,
@@ -255,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();
         
@@ -304,6 +300,16 @@ 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);
             try {
@@ -390,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) { }
index 14bdecb..8061723 100644 (file)
@@ -259,7 +259,7 @@ public class Darwin extends POSIX {
         
         
         // The blit_lock ensures the window size does not change through the entire blit operation.
-        public void render_() {
+        public void render() {
             blitLock();
             while(pendingResize) blitWait();
             if(needsReshape) {
@@ -270,7 +270,7 @@ public class Darwin extends POSIX {
                 Dirty(0,0,winWidth,winHeight);
                 //Dirty(0,0,getWidth(),getHeight());
             }
-            super.render_();
+            super.render();
             flush();
             blitUnlock();
         }