X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2FBox.java;h=524cb7c214827daee9dec7e38c62511ff13e6c4d;hb=ea80b06d1e0e190d3748df9796c1acbb4a38aea9;hp=313cefa4961cb3e3417f5e352c375de8c4623aa4;hpb=bef3357a11cb50d0c4a51076207398a684c7ef75;p=org.ibex.core.git diff --git a/src/org/ibex/Box.java b/src/org/ibex/Box.java index 313cefa..524cb7c 100644 --- a/src/org/ibex/Box.java +++ b/src/org/ibex/Box.java @@ -177,7 +177,7 @@ public final class Box extends JSScope implements Scheduler.Task { // as external events have occured, check the state of box if (texture != null) { if (texture.isLoaded) { minwidth = min(texture.width, maxwidth); minheight = min(texture.height, maxheight); } - else { JS res = texture.stream; texture = null; throw new JSExn("image not found: "+res); } + else { JS res = texture.stream; texture = null; throw new JSExn("image not found: "+res.unclone()); } } else { Log.warn(Box.class, "perform() called with null texture"); } @@ -215,10 +215,8 @@ public final class Box extends JSScope implements Scheduler.Task { // static stuff so we don't have to keep reallocating private static int[] numRowsInCol = new int[65535]; private static LENGTH[] colWidth = new LENGTH[65535]; - private static LENGTH[] colMinWidth = new LENGTH[65535]; private static LENGTH[] colMaxWidth = new LENGTH[65535]; private static LENGTH[] rowHeight = new LENGTH[65535]; - private static LENGTH[] rowMinHeight = new LENGTH[65535]; private static LENGTH[] rowMaxHeight = new LENGTH[65535]; static { for(int i=0; i 0 && cols > 0 && startslack != x_slack;) { - if (eligible == 0) break; - int increment = x_slack / eligible; - eligible = 0; + int increment = max(1, x_slack / cols); startslack = x_slack; for(short col=0; col < cols; col++) { // FIXME: double check this int diff = min(min(colMaxWidth[col], colWidth[col] + increment) - colWidth[col], x_slack); - if (colWidth[col] + diff < colMinWidth[col]) diff = colMinWidth[col] - colWidth[col]; - if (diff == 0) continue; - eligible++; x_slack -= diff; colWidth[col] += diff; } @@ -697,6 +685,7 @@ public final class Box extends JSScope implements Scheduler.Task { fillcolor = newfillcolor; } else if(value instanceof JS) { texture = Picture.load((JS)value, this); + if (texture != null) perform(); } else { throw new JSExn("fill must be null, a String, or a stream, not a " + value.getClass()); }