*/
public void repaint(int x, int y, int w, int h) {
if (dirtyRegion == null) {
dirtyRegion = new Rectangle(x, y, w, h);
} else {
Dimension size = dirtyRegion.getSize();
int x1 = Math.min(dirtyRegion.getX(), x);
int y1 = Math.min(dirtyRegion.getY(), y);
int x2 = Math.max(x + w, dirtyRegion.getX() + size.getWidth());
int y2 = Math.max(y + h, dirtyRegion.getY() + size.getHeight());
dirtyRegion.setX(x1);
dirtyRegion.setY(y1);
size.setWidth(x2 - x1);
size.setHeight(y2 - y1);
}
repaint(this);
}