/** loads the image described by string str, possibly blocking for a network load */
static ImageDecoder getImage(String str, final Function callback) {
- ImageDecoder ret = null;
boolean ispng = false;
if (str.indexOf(':') == -1) {
// arbitrarily distribute out any leftovers resulting from rounding errors
int last = 0;
- while(goal > total && total != last) {
+ while(goal != total && total != last) {
last = total;
for(Box bt = getChild(0); bt != null; bt = bt.nextSibling()) {
- int newsize = bound(bt.cmin(o), bt.size(o) + 1, bt.dmax(o));
+ int newsize = bound(bt.cmin(o), bt.size(o) + (goal > total ? 1 : -1), bt.dmax(o));
total += newsize - bt.size(o);
bt.set(size, o, newsize);
}
}
if (numKids > 15 && children == null) convert_to_array();
- if (newnode.parent != null) newnode.remove();
+ newnode.remove();
newnode.parent = this;
if (children == null) {
/** remove this node from its parent; INVARIANT: whenever the parent of a node is changed, remove() gets called. */
public void remove() {
if (parent == null) {
- if (surface != null) surface.dispose();
+ if (surface != null) surface.dispose(true);
return;
}
Box oldparent = getParent();