X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fcore%2FBox.java;h=b9f71b6ea9a2f9fffa2f6bef83bd96685c8bdf98;hb=faa4ae356d464a80e08540d5eb8bbee6296c1dbc;hp=ffec434e18da5b796e3b68d2ac3cd171ff7d12ee;hpb=531e31402f74fa636b2d9a2a367305bfd0777cdc;p=org.ibex.core.git diff --git a/src/org/ibex/core/Box.java b/src/org/ibex/core/Box.java index ffec434..b9f71b6 100644 --- a/src/org/ibex/core/Box.java +++ b/src/org/ibex/core/Box.java @@ -106,7 +106,7 @@ public final class Box extends JS.Obj implements Callable, Mesh.Chain { public void dirty() { if (path==null) dirty(0, 0, contentwidth, contentheight); else dirty(path); } public void dirty(int x, int y, int w, int h) { } public void dirty(Path p) { - Affine a = transform; + Affine a = transform.copy(); for(Box cur = this; cur != null; cur = cur.parent) a.premultiply(cur.transform); long hbounds = p.horizontalBounds(a); long vbounds = p.verticalBounds(a); @@ -173,8 +173,6 @@ public final class Box extends JS.Obj implements Callable, Mesh.Chain { public void constrain(Box b, Affine a) { contentwidth = 0; contentheight = 0; - transform.e = 0; - transform.f = 0; a = a.copy().premultiply(transform); //boolean relevant = packed() || ((fillcolor&0xff000000)!=0x0) || path!=null; @@ -192,10 +190,16 @@ public final class Box extends JS.Obj implements Callable, Mesh.Chain { for(Box child = getChild(0); child != null; child = child.nextSibling()) { xmin = Integer.MAX_VALUE; ymin = Integer.MAX_VALUE; xmax = Integer.MIN_VALUE; ymax = Integer.MIN_VALUE; + if (packed()) { + child.transform.e = 0; + child.transform.f = 0; + } child.constrain(this, Affine.identity()); if (xmin==Integer.MAX_VALUE||xmax==Integer.MIN_VALUE||ymin==Integer.MAX_VALUE||ymax== Integer.MIN_VALUE) continue; - child.transform.e = -1 * xmin; - child.transform.f = -1 * ymin; + if (packed()) { + child.transform.e = -1 * xmin; + child.transform.f = -1 * ymin; + } contentwidth += (xmax-xmin); contentheight = max(ymax-ymin, contentheight); } @@ -247,10 +251,13 @@ public final class Box extends JS.Obj implements Callable, Mesh.Chain { return; } - if (clipFrom != null) clipFrom.subtract(mesh, clipa); - Mesh mesh = treeSize() > 0 ? this.mesh.copy() : this.mesh; - for(Box b = getChild(0); b != null; b = b.nextSibling()) b.render(buf, a, mesh, Affine.identity()); + // FIXME: mesh clipping code has been getting stuck in loops; to see this, + // uncomment the next two lines and swap the order of the last two lines. + + //if (clipFrom != null) clipFrom.subtract(mesh, clipa); + //Mesh mesh = treeSize() > 0 ? this.mesh.copy() : this.mesh; mesh.fill(buf, a, null, fillcolor, true); + for(Box b = getChild(0); b != null; b = b.nextSibling()) b.render(buf, a, mesh, Affine.identity()); } // Methods to implement org.ibex.js.JS ////////////////////////////////////// @@ -398,10 +405,12 @@ public final class Box extends JS.Obj implements Callable, Mesh.Chain { dirty(); polygon = null; } + case "x": transform.e = JSU.toInt(value); + case "y": transform.f = JSU.toInt(value); case "transform": { transform = Affine.parse(JSU.toString(value)); - transform.e = 0; - transform.f = 0; + //transform.e = 0; + //transform.f = 0; if (getSurface() != null) // FIXME getSurface().dirty(0, 0, getSurface().root.contentwidth, getSurface().root.contentheight); REPLACE();