From 398688fd2b2304facd1b366b17ce84305e23ad26 Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:43:21 +0000 Subject: [PATCH] 2003/12/27 01:03:55 darcs-hash:20040130074321-2ba56-d78805ec1ee0f9b0dd5bb060ba5cc11dd204ba1c.gz --- src/org/xwt/plat/AWT.java | 22 +++++++++++----------- src/org/xwt/plat/Darwin.java | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/org/xwt/plat/AWT.java b/src/org/xwt/plat/AWT.java index c63e9a7..6a907e8 100644 --- a/src/org/xwt/plat/AWT.java +++ b/src/org/xwt/plat/AWT.java @@ -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 window */ - 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) { } diff --git a/src/org/xwt/plat/Darwin.java b/src/org/xwt/plat/Darwin.java index 14bdecb..8061723 100644 --- a/src/org/xwt/plat/Darwin.java +++ b/src/org/xwt/plat/Darwin.java @@ -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(); } -- 1.7.10.4