massive reworking of Box.java
[org.ibex.core.git] / src / org / ibex / graphics / Path.java
index 4340015..690924d 100644 (file)
@@ -61,6 +61,19 @@ public class Path {
         }
     }
 
+    //#repeat width/height multiply_px/multiply_py horizontalBounds/verticalBounds
+    public long horizontalBounds(Affine a) {
+        // FIXME wrong
+        float min = Float.MAX_VALUE;
+        float max = Float.MIN_VALUE;
+        for(int i=0; i<numvertices; i++) {
+            min = Math.min(min, a.multiply_px(x[i], y[i]));
+            max = Math.max(max, a.multiply_px(x[i], y[i]));
+        }
+        return Encode.twoFloatsToLong(max, min);
+    }
+    //#end
+
     public long transform(Affine a, boolean forReal) { return transform(a, forReal, true); }
     public long transform(Affine a, boolean forReal, boolean widthheight) {
         float minx = Integer.MAX_VALUE; float miny = Integer.MAX_VALUE;
@@ -94,11 +107,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 +179,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 +297,6 @@ public class Path {
 
             }
         }
-        } finally { Scheduler.rasterizing += System.currentTimeMillis() - start; }
     }
 
     protected void parseSingleCommandAndArguments(Tokenizer t, char command, boolean relative) {