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) {
}
protected static class AWTPicture extends Picture {
- int[] data = null;
public Image i = null;
private static ColorModel cmodel = new DirectColorModel(32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
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,
/** 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();
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);
}
}
}
+ 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();
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) { }