Fixed a bunch of bogus [] placements.

This commit is contained in:
Michael Bayne
2011-06-10 14:32:26 -07:00
parent ac1d82fff1
commit a442f451c3
7 changed files with 45 additions and 45 deletions
@@ -90,13 +90,13 @@ public abstract class AbstractEllipse extends RectangularShape implements IEllip
if (index == 0) {
type = SEG_MOVETO;
count = 1;
float p[] = POINTS[3];
float[] p = POINTS[3];
coords[0] = x + p[4] * width;
coords[1] = y + p[5] * height;
} else {
type = SEG_CUBICTO;
count = 3;
float p[] = POINTS[index - 1];
float[] p = POINTS[index - 1];
int j = 0;
for (int i = 0; i < 3; i++) {
coords[j] = x + p[j++] * width;
@@ -119,7 +119,7 @@ public abstract class AbstractRoundRectangle extends RectangularShape implements
return SEG_CLOSE;
}
int j = 0;
float p[] = POINTS[index];
float[] p = POINTS[index];
for (int i = 0; i < p.length; i += 4) {
coords[j++] = x + p[i + 0] * width + p[i + 1] * aw;
coords[j++] = y + p[i + 2] * height + p[i + 3] * ah;
+24 -24
View File
@@ -22,7 +22,7 @@ class Crossing
* @param res the roots of the equation
* @return a number of roots
*/
public static int solveQuad (float eqn[], float res[]) {
public static int solveQuad (float[] eqn, float[] res) {
float a = eqn[2];
float b = eqn[1];
float c = eqn[0];
@@ -55,7 +55,7 @@ class Crossing
* @param res the roots of the equation
* @return a number of roots
*/
public static int solveCubic (float eqn[], float res[]) {
public static int solveCubic (float[] eqn, float[] res) {
float d = eqn[3];
if (d == 0) {
return solveQuad(eqn, res);
@@ -108,7 +108,7 @@ class Crossing
* @param rc the roots count
* @return new roots count
*/
protected static int fixRoots (float res[], int rc) {
protected static int fixRoots (float[] res, int rc) {
int tc = 0;
for (int i = 0; i < rc; i++) {
out: {
@@ -144,7 +144,7 @@ class Crossing
Ay = ay - By; // Ay = ay - 2f * by
}
public int cross (float res[], int rc, float py1, float py2) {
public int cross (float[] res, int rc, float py1, float py2) {
int cross = 0;
for (int i = 0; i < rc; i++) {
@@ -184,12 +184,12 @@ class Crossing
return cross;
}
public int solvePoint (float res[], float px) {
float eqn[] = { -px, Bx, Ax };
public int solvePoint (float[] res, float px) {
float[] eqn = { -px, Bx, Ax };
return solveQuad(eqn, res);
}
public int solveExtreme (float res[]) {
public int solveExtreme (float[] res) {
int rc = 0;
if (Ax != 0f) {
res[rc++] = -Bx / (Ax + Ax);
@@ -200,7 +200,7 @@ class Crossing
return rc;
}
public int addBound (float bound[], int bc, float res[], int rc, float minX, float maxX,
public int addBound (float[] bound, int bc, float[] res, int rc, float minX, float maxX,
boolean changeId, int id) {
for (int i = 0; i < rc; i++) {
float t = res[i];
@@ -249,7 +249,7 @@ class Crossing
Bx2 = Bx + Bx;
}
public int cross (float res[], int rc, float py1, float py2) {
public int cross (float[] res, int rc, float py1, float py2) {
int cross = 0;
for (int i = 0; i < rc; i++) {
float t = res[i];
@@ -294,22 +294,22 @@ class Crossing
return cross;
}
public int solvePoint (float res[], float px) {
float eqn[] = { -px, Cx, Bx, Ax };
public int solvePoint (float[] res, float px) {
float[] eqn = { -px, Cx, Bx, Ax };
return solveCubic(eqn, res);
}
public int solveExtremeX (float res[]) {
float eqn[] = { Cx, Bx2, Ax3 };
public int solveExtremeX (float[] res) {
float[] eqn = { Cx, Bx2, Ax3 };
return solveQuad(eqn, res);
}
public int solveExtremeY (float res[]) {
float eqn[] = { Cy, By + By, Ay + Ay + Ay };
public int solveExtremeY (float[] res) {
float[] eqn = { Cy, By + By, Ay + Ay + Ay };
return solveQuad(eqn, res);
}
public int addBound (float bound[], int bc, float res[], int rc, float minX, float maxX,
public int addBound (float[] bound, int bc, float[] res, int rc, float minX, float maxX,
boolean changeId, int id) {
for (int i = 0; i < rc; i++) {
float t = res[i];
@@ -577,8 +577,8 @@ class Crossing
float px2 = rx2 - x1;
float py2 = ry2 - y1;
float res1[] = new float[3];
float res2[] = new float[3];
float[] res1 = new float[3];
float[] res2 = new float[3];
int rc1 = c.solvePoint(res1, px1);
int rc2 = c.solvePoint(res2, px2);
@@ -590,7 +590,7 @@ class Crossing
// Build bound --------------------------------------------------------
float minX = px1 - DELTA;
float maxX = px2 + DELTA;
float bound[] = new float[28];
float[] bound = new float[28];
int bc = 0;
// Add roots
bc = c.addBound(bound, bc, res1, rc1, minX, maxX, false, 0);
@@ -649,8 +649,8 @@ class Crossing
float px2 = rx2 - x1;
float py2 = ry2 - y1;
float res1[] = new float[3];
float res2[] = new float[3];
float[] res1 = new float[3];
float[] res2 = new float[3];
int rc1 = c.solvePoint(res1, px1);
int rc2 = c.solvePoint(res2, px2);
@@ -663,7 +663,7 @@ class Crossing
float maxX = px2 + DELTA;
// Build bound --------------------------------------------------------
float bound[] = new float[40];
float[] bound = new float[40];
int bc = 0;
// Add roots
bc = c.addBound(bound, bc, res1, rc1, minX, maxX, false, 0);
@@ -703,7 +703,7 @@ class Crossing
int count;
float mx, my, cx, cy;
mx = my = cx = cy = 0f;
float coords[] = new float[6];
float[] coords = new float[6];
float rx1 = x;
float ry1 = y;
@@ -812,7 +812,7 @@ class Crossing
/**
* Returns whether bounds intersect a rectangle or not.
*/
protected static int crossBound (float bound[], int bc, float py1, float py2) {
protected static int crossBound (float[] bound, int bc, float py1, float py2) {
// LEFT/RIGHT
if (bc == 0) {
return 0;
+4 -4
View File
@@ -15,7 +15,7 @@ public class CubicCurves
Lines.pointSegDistSq(ctrlx2, ctrly2, x1, y1, x2, y2));
}
public static float getFlatnessSq (float coords[], int offset) {
public static float getFlatnessSq (float[] coords, int offset) {
return getFlatnessSq(coords[offset + 0], coords[offset + 1], coords[offset + 2],
coords[offset + 3], coords[offset + 4], coords[offset + 5],
coords[offset + 6], coords[offset + 7]);
@@ -26,7 +26,7 @@ public class CubicCurves
return (float)Math.sqrt(getFlatnessSq(x1, y1, ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2));
}
public static float getFlatness (float coords[], int offset) {
public static float getFlatness (float[] coords, int offset) {
return getFlatness(coords[offset + 0], coords[offset + 1], coords[offset + 2],
coords[offset + 3], coords[offset + 4], coords[offset + 5],
coords[offset + 6], coords[offset + 7]);
@@ -54,8 +54,8 @@ public class CubicCurves
}
}
public static void subdivide (float src[], int srcOff, float left[], int leftOff,
float right[], int rightOff) {
public static void subdivide (float[] src, int srcOff, float left[], int leftOff,
float[] right, int rightOff) {
float x1 = src[srcOff + 0], y1 = src[srcOff + 1];
float cx1 = src[srcOff + 2], cy1 = src[srcOff + 3];
float cx2 = src[srcOff + 4], cy2 = src[srcOff + 5];
@@ -115,7 +115,7 @@ class FlatteningPathIterator implements PathIterator
// Realloc buffer
if (bufIndex <= 4) {
float tmp[] = new float[bufSize + BUFFER_CAPACITY];
float[] tmp = new float[bufSize + BUFFER_CAPACITY];
System.arraycopy(buf, bufIndex, tmp, bufIndex + BUFFER_CAPACITY, bufSize
- bufIndex);
buf = tmp;
@@ -156,7 +156,7 @@ class FlatteningPathIterator implements PathIterator
// Realloc buffer
if (bufIndex <= 6) {
float tmp[] = new float[bufSize + BUFFER_CAPACITY];
float[] tmp = new float[bufSize + BUFFER_CAPACITY];
System.arraycopy(buf, bufIndex, tmp, bufIndex + BUFFER_CAPACITY, bufSize
- bufIndex);
buf = tmp;
@@ -199,7 +199,7 @@ class FlatteningPathIterator implements PathIterator
private int bufSubdiv;
/** The points buffer */
private float buf[];
private float[] buf;
/** The indicator of empty points buffer */
private boolean bufEmpty = true;
@@ -220,7 +220,7 @@ class FlatteningPathIterator implements PathIterator
private float py;
/** The tamporary buffer for getting points from PathIterator */
private float coords[] = new float[6];
private float[] coords = new float[6];
/** The default points buffer size */
private static final int BUFFER_SIZE = 16;
+8 -8
View File
@@ -102,7 +102,7 @@ public final class Path implements IShape, Cloneable
public void append (PathIterator path, boolean connect) {
while (!path.isDone()) {
float coords[] = new float[6];
float[] coords = new float[6];
switch (path.currentSegment(coords)) {
case PathIterator.SEG_MOVETO:
if (!connect || typeSize == 0) {
@@ -271,12 +271,12 @@ public final class Path implements IShape, Cloneable
throw new IllegalPathStateException("First segment must be a SEG_MOVETO");
}
if (typeSize == types.length) {
byte tmp[] = new byte[typeSize + BUFFER_CAPACITY];
byte[] tmp = new byte[typeSize + BUFFER_CAPACITY];
System.arraycopy(types, 0, tmp, 0, typeSize);
types = tmp;
}
if (pointSize + pointCount > points.length) {
float tmp[] = new float[pointSize + Math.max(BUFFER_CAPACITY * 2, pointCount)];
float[] tmp = new float[pointSize + Math.max(BUFFER_CAPACITY * 2, pointCount)];
System.arraycopy(points, 0, tmp, 0, pointSize);
points = tmp;
}
@@ -360,11 +360,11 @@ public final class Path implements IShape, Cloneable
protected int rule;
/** The space required in points buffer for different segmenet types. */
protected static int pointShift[] = { 2, // MOVETO
2, // LINETO
4, // QUADTO
6, // CUBICTO
0 }; // CLOSE
protected static int[] pointShift = { 2, // MOVETO
2, // LINETO
4, // QUADTO
6, // CUBICTO
0 }; // CLOSE
/** The default initial buffer size. */
protected static final int BUFFER_SIZE = 10;
+2 -2
View File
@@ -14,7 +14,7 @@ public class QuadCurves
return Lines.pointSegDistSq(ctrlx, ctrly, x1, y1, x2, y2);
}
public static float getFlatnessSq (float coords[], int offset) {
public static float getFlatnessSq (float[] coords, int offset) {
return Lines.pointSegDistSq(coords[offset + 2], coords[offset + 3],
coords[offset + 0], coords[offset + 1],
coords[offset + 4], coords[offset + 5]);
@@ -53,7 +53,7 @@ public class QuadCurves
}
public static void subdivide (float[] src, int srcoff,
float left[], int leftOff, float[] right, int rightOff) {
float[] left, int leftOff, float[] right, int rightOff) {
float x1 = src[srcoff + 0];
float y1 = src[srcoff + 1];
float cx = src[srcoff + 2];