From: adam Date: Sun, 9 Jan 2005 07:31:59 +0000 (+0000) Subject: merger to harmonize svg patches X-Git-Tag: 01-July-2005~41 X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=2ea4142ec6959e6663f83ab23a26bb202ffce226 merger to harmonize svg patches darcs-hash:20050109073159-5007d-1b3a45a165f15ecd25f7ffc83f88d80cafdb4d58.gz --- diff --git a/src/org/ibex/core/Box.java b/src/org/ibex/core/Box.java index ce0b4e7..17323c1 100644 --- a/src/org/ibex/core/Box.java +++ b/src/org/ibex/core/Box.java @@ -437,7 +437,7 @@ public final class Box extends JS.Obj implements Callable { font.rasterizeGlyphs(text, buf, strokecolor, text_x, text_y, cx1, cy1, cx2, cy2); } - if (path != null) path.realize(Affine.translate(globalx, globaly)).stroke(buf, 1, strokecolor); + if (path != null) new Polygon(path, Affine.translate(globalx, globaly)).stroke(buf, strokecolor); for(Box b = getChild(0); b != null; b = b.nextSibling()) b.render(globalx, globaly, cx1, cy1, cx2, cy2, buf, null); @@ -570,7 +570,7 @@ public final class Box extends JS.Obj implements Callable { case "shrink": CHECKSET_FLAG(HSHRINK | VSHRINK); RECONSTRAIN(); case "hshrink": CHECKSET_FLAG(HSHRINK); RECONSTRAIN(); case "vshrink": CHECKSET_FLAG(VSHRINK); RECONSTRAIN(); - case "path": path = Path.parse(JSU.toString(value)); RECONSTRAIN(); dirty(); + case "path": path = new Path(JSU.toString(value)); RECONSTRAIN(); dirty(); case "width": setWidth(JSU.toInt(value), JSU.toInt(value)); case "height": setHeight(JSU.toInt(value), JSU.toInt(value)); case "maxwidth": setWidth(minwidth, JSU.toInt(value)); diff --git a/src/org/ibex/graphics/Path.java b/src/org/ibex/graphics/Path.java index 4340015..5d04490 100644 --- a/src/org/ibex/graphics/Path.java +++ b/src/org/ibex/graphics/Path.java @@ -94,11 +94,6 @@ public class Path { } - // FIXME: hack - private String toString; - private Path(String s) { this.toString = s; } - public String toString() { return toString; } - public static class Tokenizer { // FIXME: check array bounds exception for improperly terminated string String s; @@ -171,7 +166,6 @@ public class Path { /** Creates a concrete vector path transformed through the given matrix. */ public void addTo(Polygon ret, Affine a) { - long start = System.currentTimeMillis(); try { float NUMSTEPS = 5; // FIXME ret.x[0] = a.multiply_px(x[0], y[0]); ret.y[0] = a.multiply_py(x[0], y[0]); @@ -290,7 +284,6 @@ public class Path { } } - } finally { Scheduler.rasterizing += System.currentTimeMillis() - start; } } protected void parseSingleCommandAndArguments(Tokenizer t, char command, boolean relative) { diff --git a/src/org/ibex/graphics/Polygon.java b/src/org/ibex/graphics/Polygon.java index c99797c..5870383 100644 --- a/src/org/ibex/graphics/Polygon.java +++ b/src/org/ibex/graphics/Polygon.java @@ -198,9 +198,7 @@ public final class Polygon { float y1 = p.y[p.edges[i]]; float x2 = p.x[p.edges[i]+1]; float y2 = p.y[p.edges[i]+1]; - long start = System.currentTimeMillis(); try { - buf.drawLine((int)Math.floor(x1), (int)Math.floor(y1), (int)Math.ceil(x2), (int)Math.ceil(y2), color); - } finally { Scheduler.drawing += System.currentTimeMillis() - start; } + buf.drawLine((int)Math.floor(x1), (int)Math.floor(y1), (int)Math.ceil(x2), (int)Math.ceil(y2), 1, color, false); } } @@ -260,9 +258,7 @@ public final class Polygon { int tx1b = intercept(p.edges[rightSegment], y0, true, true); int tx2a = intercept(p.edges[leftSegment], y1, true, true); int tx2b = intercept(p.edges[rightSegment], y1, true, true); - long start = System.currentTimeMillis(); try { - buf.fillTrapezoid(tx1a, tx1b, (int)y0, tx2a, tx2b, (int)y1, ((Paint.SingleColorPaint)paint).color); - } finally { Scheduler.drawing += System.currentTimeMillis() - start; } + buf.fillTrapezoid(tx1a, tx1b, (int)y0, tx2a, tx2b, (int)y1, ((Paint.SingleColorPaint)paint).color); } if (useEvenOdd) count++; else count += (p.y[p.edges[rightSegment]] < p.y[p.edges[rightSegment]+1]) ? -1 : 1; @@ -349,9 +345,7 @@ public final class Polygon { private static Polygon clip(byte op, Polygon subj, Polygon clip) { try { - long start = System.currentTimeMillis(); try { return clip_(op, subj, clip); - } finally { Scheduler.clipping += System.currentTimeMillis() - start; } } catch (Exception npe) { npe.printStackTrace(); return null;