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();
}
}
+ 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 {
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) { }
// 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) {
Dirty(0,0,winWidth,winHeight);
//Dirty(0,0,getWidth(),getHeight());
}
- super.render_();
+ super.render();
flush();
blitUnlock();
}