merger to harmonize svg patches
authoradam <adam@megacz.com>
Sun, 9 Jan 2005 07:31:59 +0000 (07:31 +0000)
committeradam <adam@megacz.com>
Sun, 9 Jan 2005 07:31:59 +0000 (07:31 +0000)
darcs-hash:20050109073159-5007d-1b3a45a165f15ecd25f7ffc83f88d80cafdb4d58.gz

src/org/ibex/core/Box.java
src/org/ibex/graphics/Path.java
src/org/ibex/graphics/Polygon.java

index ce0b4e7..17323c1 100644 (file)
@@ -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));
index 4340015..5d04490 100644 (file)
@@ -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) {
index c99797c..5870383 100644 (file)
@@ -198,9 +198,7 @@ public final class Polygon {
             float y1 = p.y[p.edges[i]];\r
             float x2 = p.x[p.edges[i]+1];\r
             float y2 = p.y[p.edges[i]+1];\r
-            long start = System.currentTimeMillis(); try {\r
-                buf.drawLine((int)Math.floor(x1), (int)Math.floor(y1), (int)Math.ceil(x2), (int)Math.ceil(y2), color);\r
-            } finally { Scheduler.drawing += System.currentTimeMillis() - start; }\r
+            buf.drawLine((int)Math.floor(x1), (int)Math.floor(y1), (int)Math.ceil(x2), (int)Math.ceil(y2), 1, color, false);\r
         }\r
     }\r
 \r
@@ -260,9 +258,7 @@ public final class Polygon {
                         int tx1b = intercept(p.edges[rightSegment], y0, true, true);\r
                         int tx2a = intercept(p.edges[leftSegment], y1, true, true);\r
                         int tx2b = intercept(p.edges[rightSegment], y1, true, true);\r
-                        long start = System.currentTimeMillis(); try {\r
-                            buf.fillTrapezoid(tx1a, tx1b, (int)y0, tx2a, tx2b, (int)y1, ((Paint.SingleColorPaint)paint).color);\r
-                        } finally { Scheduler.drawing += System.currentTimeMillis() - start; }\r
+                        buf.fillTrapezoid(tx1a, tx1b, (int)y0, tx2a, tx2b, (int)y1, ((Paint.SingleColorPaint)paint).color);\r
                     }\r
                 if (useEvenOdd) count++;\r
                 else count += (p.y[p.edges[rightSegment]] < p.y[p.edges[rightSegment]+1]) ? -1 : 1;\r
@@ -349,9 +345,7 @@ public final class Polygon {
 \r
     private static Polygon clip(byte op, Polygon subj, Polygon clip) {\r
         try {\r
-            long start = System.currentTimeMillis(); try {\r
             return clip_(op, subj, clip);\r
-            } finally { Scheduler.clipping += System.currentTimeMillis() - start; }\r
         } catch (Exception npe) {\r
             npe.printStackTrace();\r
             return null;\r