public MapLayer createDiff(MapLayer ml) { if (ml == null) { return null; } Rectangle r = new Rectangle(); boolean start = false; for (int i = bounds.y; i < bounds.height + bounds.y; i++) { for (int j = bounds.x; j < bounds.width + bounds.x; j++) { if (ml.getTileAt(j, i) != getTileAt(j, i)) { if (start) { r.width = Math.max(Math.abs(j - r.x), r.width); r.height = Math.max(Math.abs(i - r.y), r.height);
public MapLayer createDiff(MapLayer ml) { if (ml == null) { return null; }  Rectangle r = null;  for (int y = bounds.y; y < bounds.height + bounds.y; y++) { for (int x = bounds.x; x < bounds.width + bounds.x; x++) { if (ml.getTileAt(x, y) != getTileAt(x, y)) { if (r != null) { r.add(x, y);
    public MapLayer createDiff(MapLayer ml) {		        if (ml == null) {            return null;        }        Rectangle r = new Rectangle();        boolean start = false;        for (int i = bounds.y; i < bounds.height + bounds.y; i++) {            for (int j = bounds.x; j < bounds.width + bounds.x; j++) {                if (ml.getTileAt(j, i) != getTileAt(j, i)) {                    if (start) {                        r.width = Math.max(Math.abs(j - r.x), r.width);                        r.height = Math.max(Math.abs(i - r.y), r.height);                    } else {                        start = true;                        r.x = j;                        r.y = i;                    }                }            }        }        MapLayer diff = new MapLayer(r);        diff.copyFrom(ml);		        return diff;    }