Replace C/C++ style array declarations with Java style array decl… (#49)

Replace C/C++ style array declarations with Java style array declarations
This commit is contained in:
Ben Fry
2020-01-18 19:49:36 -05:00
committed by GitHub
14 changed files with 301 additions and 317 deletions
+5 -5
View File
@@ -82,7 +82,7 @@ public class PGraphicsJava2D extends PGraphics {
float[] curveDrawY;
int transformCount;
AffineTransform transformStack[] =
AffineTransform[] transformStack =
new AffineTransform[MATRIX_STACK_DEPTH];
double[] transform = new double[6];
@@ -782,7 +782,7 @@ public class PGraphicsJava2D extends PGraphics {
//float vertex[];
if (vertexCount == vertices.length) {
float temp[][] = new float[vertexCount<<1][VERTEX_FIELD_COUNT];
float[][] temp = new float[vertexCount<<1][VERTEX_FIELD_COUNT];
System.arraycopy(vertices, 0, temp, 0, vertexCount);
vertices = temp;
//message(CHATTER, "allocating more vertices " + vertices.length);
@@ -1959,7 +1959,7 @@ public class PGraphicsJava2D extends PGraphics {
@Override
protected float textWidthImpl(char buffer[], int start, int stop) {
protected float textWidthImpl(char[] buffer, int start, int stop) {
if (textFont == null) {
defaultFontOrDeath("textWidth");
}
@@ -2028,7 +2028,7 @@ public class PGraphicsJava2D extends PGraphics {
@Override
protected void textLineImpl(char buffer[], int start, int stop,
protected void textLineImpl(char[] buffer, int start, int stop,
float x, float y) {
Font font = (Font) textFont.getNative();
// if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) {
@@ -2828,7 +2828,7 @@ public class PGraphicsJava2D extends PGraphics {
// GET/SET
static int getset[] = new int[1];
static int[] getset = new int[1];
@Override
+167 -185
View File
@@ -5509,7 +5509,7 @@ public class PApplet implements PConstants {
}
if (extension.equals("tif") || extension.equals("tiff")) {
byte bytes[] = loadBytes(filename);
byte[] bytes = loadBytes(filename);
PImage image = (bytes == null) ? null : PImage.loadTIFF(bytes);
// if (params != null) {
// image.setParams(g, params);
@@ -5524,7 +5524,7 @@ public class PApplet implements PConstants {
if (extension.equals("jpg") || extension.equals("jpeg") ||
extension.equals("gif") || extension.equals("png") ||
extension.equals("unknown")) {
byte bytes[] = loadBytes(filename);
byte[] bytes = loadBytes(filename);
if (bytes == null) {
return null;
} else {
@@ -5726,7 +5726,7 @@ public class PApplet implements PConstants {
InputStream is = createInput(filename);
if (is == null) return null;
byte header[] = new byte[18];
byte[] header = new byte[18];
int offset = 0;
do {
int count = is.read(header, offset, header.length - offset);
@@ -5846,7 +5846,7 @@ public class PApplet implements PConstants {
} else { // header[2] is 10 or 11
int index = 0;
int px[] = outgoing.pixels;
int[] px = outgoing.pixels;
while (index < px.length) {
int num = is.read();
@@ -7561,12 +7561,12 @@ public class PApplet implements PConstants {
static public String[] loadStrings(BufferedReader reader) {
try {
String lines[] = new String[100];
String[] lines = new String[100];
int lineCount = 0;
String line = null;
while ((line = reader.readLine()) != null) {
if (lineCount == lines.length) {
String temp[] = new String[lineCount << 1];
String[] temp = new String[lineCount << 1];
System.arraycopy(lines, 0, temp, 0, lineCount);
lines = temp;
}
@@ -7579,7 +7579,7 @@ public class PApplet implements PConstants {
}
// resize array to appropriate amount for these lines
String output[] = new String[lineCount];
String[] output = new String[lineCount];
System.arraycopy(lines, 0, output, 0, lineCount);
return output;
@@ -7880,7 +7880,7 @@ public class PApplet implements PConstants {
* @see PApplet#loadBytes(String)
* @see PApplet#saveBytes(String, byte[])
*/
public void saveStrings(String filename, String data[]) {
public void saveStrings(String filename, String[] data) {
saveStrings(saveFile(filename), data);
}
@@ -7888,7 +7888,7 @@ public class PApplet implements PConstants {
/**
* @nowebref
*/
static public void saveStrings(File file, String data[]) {
static public void saveStrings(File file, String[] data) {
saveStrings(createOutput(file), data);
}
@@ -8202,7 +8202,7 @@ public class PApplet implements PConstants {
* @param list array to sort
* @see PApplet#reverse(boolean[])
*/
static public byte[] sort(byte list[]) {
static public byte[] sort(byte[] list) {
return sort(list, list.length);
}
@@ -8216,7 +8216,7 @@ public class PApplet implements PConstants {
return outgoing;
}
static public char[] sort(char list[]) {
static public char[] sort(char[] list) {
return sort(list, list.length);
}
@@ -8227,7 +8227,7 @@ public class PApplet implements PConstants {
return outgoing;
}
static public int[] sort(int list[]) {
static public int[] sort(int[] list) {
return sort(list, list.length);
}
@@ -8238,7 +8238,7 @@ public class PApplet implements PConstants {
return outgoing;
}
static public float[] sort(float list[]) {
static public float[] sort(float[] list) {
return sort(list, list.length);
}
@@ -8249,7 +8249,7 @@ public class PApplet implements PConstants {
return outgoing;
}
static public String[] sort(String list[]) {
static public String[] sort(String[] list) {
return sort(list, list.length);
}
@@ -8356,85 +8356,85 @@ public class PApplet implements PConstants {
* @param list the array to expand
* @see PApplet#shorten(boolean[])
*/
static public boolean[] expand(boolean list[]) {
static public boolean[] expand(boolean[] list) {
return expand(list, list.length > 0 ? list.length << 1 : 1);
}
/**
* @param newSize new size for the array
*/
static public boolean[] expand(boolean list[], int newSize) {
boolean temp[] = new boolean[newSize];
static public boolean[] expand(boolean[] list, int newSize) {
boolean[] temp = new boolean[newSize];
System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length));
return temp;
}
static public byte[] expand(byte list[]) {
static public byte[] expand(byte[] list) {
return expand(list, list.length > 0 ? list.length << 1 : 1);
}
static public byte[] expand(byte list[], int newSize) {
byte temp[] = new byte[newSize];
static public byte[] expand(byte[] list, int newSize) {
byte[] temp = new byte[newSize];
System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length));
return temp;
}
static public char[] expand(char list[]) {
static public char[] expand(char[] list) {
return expand(list, list.length > 0 ? list.length << 1 : 1);
}
static public char[] expand(char list[], int newSize) {
char temp[] = new char[newSize];
static public char[] expand(char[] list, int newSize) {
char[] temp = new char[newSize];
System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length));
return temp;
}
static public int[] expand(int list[]) {
static public int[] expand(int[] list) {
return expand(list, list.length > 0 ? list.length << 1 : 1);
}
static public int[] expand(int list[], int newSize) {
int temp[] = new int[newSize];
static public int[] expand(int[] list, int newSize) {
int[] temp = new int[newSize];
System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length));
return temp;
}
static public long[] expand(long list[]) {
static public long[] expand(long[] list) {
return expand(list, list.length > 0 ? list.length << 1 : 1);
}
static public long[] expand(long list[], int newSize) {
long temp[] = new long[newSize];
static public long[] expand(long[] list, int newSize) {
long[] temp = new long[newSize];
System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length));
return temp;
}
static public float[] expand(float list[]) {
static public float[] expand(float[] list) {
return expand(list, list.length > 0 ? list.length << 1 : 1);
}
static public float[] expand(float list[], int newSize) {
float temp[] = new float[newSize];
static public float[] expand(float[] list, int newSize) {
float[] temp = new float[newSize];
System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length));
return temp;
}
static public double[] expand(double list[]) {
static public double[] expand(double[] list) {
return expand(list, list.length > 0 ? list.length << 1 : 1);
}
static public double[] expand(double list[], int newSize) {
double temp[] = new double[newSize];
static public double[] expand(double[] list, int newSize) {
double[] temp = new double[newSize];
System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length));
return temp;
}
static public String[] expand(String list[]) {
static public String[] expand(String[] list) {
return expand(list, list.length > 0 ? list.length << 1 : 1);
}
static public String[] expand(String list[], int newSize) {
String temp[] = new String[newSize];
static public String[] expand(String[] list, int newSize) {
String[] temp = new String[newSize];
// in case the new size is smaller than list.length
System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length));
return temp;
@@ -8478,31 +8478,31 @@ public class PApplet implements PConstants {
* @see PApplet#shorten(boolean[])
* @see PApplet#expand(boolean[])
*/
static public byte[] append(byte array[], byte value) {
static public byte[] append(byte[] array, byte value) {
array = expand(array, array.length + 1);
array[array.length-1] = value;
return array;
}
static public char[] append(char array[], char value) {
static public char[] append(char[] array, char value) {
array = expand(array, array.length + 1);
array[array.length-1] = value;
return array;
}
static public int[] append(int array[], int value) {
static public int[] append(int[] array, int value) {
array = expand(array, array.length + 1);
array[array.length-1] = value;
return array;
}
static public float[] append(float array[], float value) {
static public float[] append(float[] array, float value) {
array = expand(array, array.length + 1);
array[array.length-1] = value;
return array;
}
static public String[] append(String array[], String value) {
static public String[] append(String[] array, String value) {
array = expand(array, array.length + 1);
array[array.length-1] = value;
return array;
@@ -8532,27 +8532,27 @@ public class PApplet implements PConstants {
* @see PApplet#append(byte[], byte)
* @see PApplet#expand(boolean[])
*/
static public boolean[] shorten(boolean list[]) {
static public boolean[] shorten(boolean[] list) {
return subset(list, 0, list.length-1);
}
static public byte[] shorten(byte list[]) {
static public byte[] shorten(byte[] list) {
return subset(list, 0, list.length-1);
}
static public char[] shorten(char list[]) {
static public char[] shorten(char[] list) {
return subset(list, 0, list.length-1);
}
static public int[] shorten(int list[]) {
static public int[] shorten(int[] list) {
return subset(list, 0, list.length-1);
}
static public float[] shorten(float list[]) {
static public float[] shorten(float[] list) {
return subset(list, 0, list.length-1);
}
static public String[] shorten(String list[]) {
static public String[] shorten(String[] list) {
return subset(list, 0, list.length-1);
}
@@ -8582,9 +8582,9 @@ public class PApplet implements PConstants {
* @see PApplet#concat(boolean[], boolean[])
* @see PApplet#subset(boolean[], int, int)
*/
static final public boolean[] splice(boolean list[],
static final public boolean[] splice(boolean[] list,
boolean value, int index) {
boolean outgoing[] = new boolean[list.length + 1];
boolean[] outgoing = new boolean[list.length + 1];
System.arraycopy(list, 0, outgoing, 0, index);
outgoing[index] = value;
System.arraycopy(list, index, outgoing, index + 1,
@@ -8592,9 +8592,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public boolean[] splice(boolean list[],
boolean value[], int index) {
boolean outgoing[] = new boolean[list.length + value.length];
static final public boolean[] splice(boolean[] list,
boolean[] value, int index) {
boolean[] outgoing = new boolean[list.length + value.length];
System.arraycopy(list, 0, outgoing, 0, index);
System.arraycopy(value, 0, outgoing, index, value.length);
System.arraycopy(list, index, outgoing, index + value.length,
@@ -8602,9 +8602,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public byte[] splice(byte list[],
static final public byte[] splice(byte[] list,
byte value, int index) {
byte outgoing[] = new byte[list.length + 1];
byte[] outgoing = new byte[list.length + 1];
System.arraycopy(list, 0, outgoing, 0, index);
outgoing[index] = value;
System.arraycopy(list, index, outgoing, index + 1,
@@ -8612,9 +8612,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public byte[] splice(byte list[],
byte value[], int index) {
byte outgoing[] = new byte[list.length + value.length];
static final public byte[] splice(byte[] list,
byte[] value, int index) {
byte[] outgoing = new byte[list.length + value.length];
System.arraycopy(list, 0, outgoing, 0, index);
System.arraycopy(value, 0, outgoing, index, value.length);
System.arraycopy(list, index, outgoing, index + value.length,
@@ -8623,9 +8623,9 @@ public class PApplet implements PConstants {
}
static final public char[] splice(char list[],
static final public char[] splice(char[] list,
char value, int index) {
char outgoing[] = new char[list.length + 1];
char[] outgoing = new char[list.length + 1];
System.arraycopy(list, 0, outgoing, 0, index);
outgoing[index] = value;
System.arraycopy(list, index, outgoing, index + 1,
@@ -8633,9 +8633,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public char[] splice(char list[],
char value[], int index) {
char outgoing[] = new char[list.length + value.length];
static final public char[] splice(char[] list,
char[] value, int index) {
char[] outgoing = new char[list.length + value.length];
System.arraycopy(list, 0, outgoing, 0, index);
System.arraycopy(value, 0, outgoing, index, value.length);
System.arraycopy(list, index, outgoing, index + value.length,
@@ -8643,9 +8643,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public int[] splice(int list[],
static final public int[] splice(int[] list,
int value, int index) {
int outgoing[] = new int[list.length + 1];
int[] outgoing = new int[list.length + 1];
System.arraycopy(list, 0, outgoing, 0, index);
outgoing[index] = value;
System.arraycopy(list, index, outgoing, index + 1,
@@ -8653,9 +8653,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public int[] splice(int list[],
int value[], int index) {
int outgoing[] = new int[list.length + value.length];
static final public int[] splice(int[] list,
int[] value, int index) {
int[] outgoing = new int[list.length + value.length];
System.arraycopy(list, 0, outgoing, 0, index);
System.arraycopy(value, 0, outgoing, index, value.length);
System.arraycopy(list, index, outgoing, index + value.length,
@@ -8663,9 +8663,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public float[] splice(float list[],
static final public float[] splice(float[] list,
float value, int index) {
float outgoing[] = new float[list.length + 1];
float[] outgoing = new float[list.length + 1];
System.arraycopy(list, 0, outgoing, 0, index);
outgoing[index] = value;
System.arraycopy(list, index, outgoing, index + 1,
@@ -8673,9 +8673,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public float[] splice(float list[],
float value[], int index) {
float outgoing[] = new float[list.length + value.length];
static final public float[] splice(float[] list,
float[] value, int index) {
float[] outgoing = new float[list.length + value.length];
System.arraycopy(list, 0, outgoing, 0, index);
System.arraycopy(value, 0, outgoing, index, value.length);
System.arraycopy(list, index, outgoing, index + value.length,
@@ -8683,9 +8683,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public String[] splice(String list[],
static final public String[] splice(String[] list,
String value, int index) {
String outgoing[] = new String[list.length + 1];
String[] outgoing = new String[list.length + 1];
System.arraycopy(list, 0, outgoing, 0, index);
outgoing[index] = value;
System.arraycopy(list, index, outgoing, index + 1,
@@ -8693,9 +8693,9 @@ public class PApplet implements PConstants {
return outgoing;
}
static final public String[] splice(String list[],
String value[], int index) {
String outgoing[] = new String[list.length + value.length];
static final public String[] splice(String[] list,
String[] value, int index) {
String[] outgoing = new String[list.length + value.length];
System.arraycopy(list, 0, outgoing, 0, index);
System.arraycopy(value, 0, outgoing, index, value.length);
System.arraycopy(list, index, outgoing, index + value.length,
@@ -8876,43 +8876,43 @@ public class PApplet implements PConstants {
* @see PApplet#splice(boolean[], boolean, int)
* @see PApplet#arrayCopy(Object, int, Object, int, int)
*/
static public boolean[] concat(boolean a[], boolean b[]) {
boolean c[] = new boolean[a.length + b.length];
static public boolean[] concat(boolean[] a, boolean[] b) {
boolean[] c = new boolean[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
}
static public byte[] concat(byte a[], byte b[]) {
byte c[] = new byte[a.length + b.length];
static public byte[] concat(byte[] a, byte[] b) {
byte[] c = new byte[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
}
static public char[] concat(char a[], char b[]) {
char c[] = new char[a.length + b.length];
static public char[] concat(char[] a, char[] b) {
char[] c = new char[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
}
static public int[] concat(int a[], int b[]) {
int c[] = new int[a.length + b.length];
static public int[] concat(int[] a, int[] b) {
int[] c = new int[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
}
static public float[] concat(float a[], float b[]) {
float c[] = new float[a.length + b.length];
static public float[] concat(float[] a, float[] b) {
float[] c = new float[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
}
static public String[] concat(String a[], String b[]) {
String c[] = new String[a.length + b.length];
static public String[] concat(String[] a, String[] b) {
String[] c = new String[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
@@ -8941,8 +8941,8 @@ public class PApplet implements PConstants {
* @param list booleans[], bytes[], chars[], ints[], floats[], or Strings[]
* @see PApplet#sort(String[], int)
*/
static public boolean[] reverse(boolean list[]) {
boolean outgoing[] = new boolean[list.length];
static public boolean[] reverse(boolean[] list) {
boolean[] outgoing = new boolean[list.length];
int length1 = list.length - 1;
for (int i = 0; i < list.length; i++) {
outgoing[i] = list[length1 - i];
@@ -8950,8 +8950,8 @@ public class PApplet implements PConstants {
return outgoing;
}
static public byte[] reverse(byte list[]) {
byte outgoing[] = new byte[list.length];
static public byte[] reverse(byte[] list) {
byte[] outgoing = new byte[list.length];
int length1 = list.length - 1;
for (int i = 0; i < list.length; i++) {
outgoing[i] = list[length1 - i];
@@ -8959,8 +8959,8 @@ public class PApplet implements PConstants {
return outgoing;
}
static public char[] reverse(char list[]) {
char outgoing[] = new char[list.length];
static public char[] reverse(char[] list) {
char[] outgoing = new char[list.length];
int length1 = list.length - 1;
for (int i = 0; i < list.length; i++) {
outgoing[i] = list[length1 - i];
@@ -8968,8 +8968,8 @@ public class PApplet implements PConstants {
return outgoing;
}
static public int[] reverse(int list[]) {
int outgoing[] = new int[list.length];
static public int[] reverse(int[] list) {
int[] outgoing = new int[list.length];
int length1 = list.length - 1;
for (int i = 0; i < list.length; i++) {
outgoing[i] = list[length1 - i];
@@ -8977,8 +8977,8 @@ public class PApplet implements PConstants {
return outgoing;
}
static public float[] reverse(float list[]) {
float outgoing[] = new float[list.length];
static public float[] reverse(float[] list) {
float[] outgoing = new float[list.length];
int length1 = list.length - 1;
for (int i = 0; i < list.length; i++) {
outgoing[i] = list[length1 - i];
@@ -8986,8 +8986,8 @@ public class PApplet implements PConstants {
return outgoing;
}
static public String[] reverse(String list[]) {
String outgoing[] = new String[list.length];
static public String[] reverse(String[] list) {
String[] outgoing = new String[list.length];
int length1 = list.length - 1;
for (int i = 0; i < list.length; i++) {
outgoing[i] = list[length1 - i];
@@ -9110,7 +9110,7 @@ public class PApplet implements PConstants {
*/
static public String[] splitTokens(String value, String delim) {
StringTokenizer toker = new StringTokenizer(value, delim);
String pieces[] = new String[toker.countTokens()];
String[] pieces = new String[toker.countTokens()];
int index = 0;
while (toker.hasMoreTokens()) {
@@ -9160,7 +9160,7 @@ public class PApplet implements PConstants {
if (value == null) return null;
//return split(what, String.valueOf(delim)); // huh
char chars[] = value.toCharArray();
char[] chars = value.toCharArray();
int splitCount = 0; //1;
for (int i = 0; i < chars.length; i++) {
if (chars[i] == delim) splitCount++;
@@ -9172,12 +9172,12 @@ public class PApplet implements PConstants {
// on second thought, i don't agree with this, will disable
//}
if (splitCount == 0) {
String splits[] = new String[1];
String[] splits = new String[1];
splits[0] = value;
return splits;
}
//int pieceCount = splitCount + 1;
String splits[] = new String[splitCount + 1];
String[] splits = new String[splitCount + 1];
int splitIndex = 0;
int startIndex = 0;
for (int i = 0; i < chars.length; i++) {
@@ -9418,8 +9418,8 @@ public class PApplet implements PConstants {
* to zero will return false, and any other value will return true.
* @return array of boolean elements
*/
static final public boolean[] parseBoolean(int what[]) {
boolean outgoing[] = new boolean[what.length];
static final public boolean[] parseBoolean(int[] what) {
boolean[] outgoing = new boolean[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = (what[i] != 0);
}
@@ -9437,8 +9437,8 @@ public class PApplet implements PConstants {
}
*/
static final public boolean[] parseBoolean(String what[]) {
boolean outgoing[] = new boolean[what.length];
static final public boolean[] parseBoolean(String[] what) {
boolean[] outgoing = new boolean[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = Boolean.parseBoolean(what[i]);
}
@@ -9472,32 +9472,32 @@ public class PApplet implements PConstants {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
static final public byte[] parseByte(boolean what[]) {
byte outgoing[] = new byte[what.length];
static final public byte[] parseByte(boolean[] what) {
byte[] outgoing = new byte[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = what[i] ? (byte)1 : 0;
}
return outgoing;
}
static final public byte[] parseByte(char what[]) {
byte outgoing[] = new byte[what.length];
static final public byte[] parseByte(char[] what) {
byte[] outgoing = new byte[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = (byte) what[i];
}
return outgoing;
}
static final public byte[] parseByte(int what[]) {
byte outgoing[] = new byte[what.length];
static final public byte[] parseByte(int[] what) {
byte[] outgoing = new byte[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = (byte) what[i];
}
return outgoing;
}
static final public byte[] parseByte(float what[]) {
byte outgoing[] = new byte[what.length];
static final public byte[] parseByte(float[] what) {
byte[] outgoing = new byte[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = (byte) what[i];
}
@@ -9552,8 +9552,8 @@ public class PApplet implements PConstants {
}
*/
static final public char[] parseChar(byte what[]) {
char outgoing[] = new char[what.length];
static final public char[] parseChar(byte[] what) {
char[] outgoing = new char[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = (char) (what[i] & 0xff);
}
@@ -9569,8 +9569,8 @@ public class PApplet implements PConstants {
}
/*
static final public char[] parseChar(float what[]) { // nonsensical
char outgoing[] = new char[what.length];
static final public char[] parseChar(int[] what) {
char[] outgoing = new char[what.length];
for (int i = 0; i < what.length; i++) {
outgoing[i] = (char) what[i];
}
@@ -9640,32 +9640,32 @@ public class PApplet implements PConstants {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
static final public int[] parseInt(boolean what[]) {
int list[] = new int[what.length];
static final public int[] parseInt(boolean[] what) {
int[] list = new int[what.length];
for (int i = 0; i < what.length; i++) {
list[i] = what[i] ? 1 : 0;
}
return list;
}
static final public int[] parseInt(byte what[]) { // note this unsigns
int list[] = new int[what.length];
static final public int[] parseInt(byte[] what) { // note this unsigns
int[] list = new int[what.length];
for (int i = 0; i < what.length; i++) {
list[i] = (what[i] & 0xff);
}
return list;
}
static final public int[] parseInt(char what[]) {
int list[] = new int[what.length];
static final public int[] parseInt(char[] what) {
int[] list = new int[what.length];
for (int i = 0; i < what.length; i++) {
list[i] = what[i];
}
return list;
}
static public int[] parseInt(float what[]) {
int inties[] = new int[what.length];
static public int[] parseInt(float[] what) {
int[] inties = new int[what.length];
for (int i = 0; i < what.length; i++) {
inties[i] = (int)what[i];
}
@@ -9681,7 +9681,7 @@ public class PApplet implements PConstants {
*
* numbers will contain { 1, 300, 44 }
*/
static public int[] parseInt(String what[]) {
static public int[] parseInt(String[] what) {
return parseInt(what, 0);
}
@@ -9695,8 +9695,8 @@ public class PApplet implements PConstants {
*
* numbers will contain { 1, 300, 9999, 44 }
*/
static public int[] parseInt(String what[], int missing) {
int output[] = new int[what.length];
static public int[] parseInt(String[] what, int missing) {
int[] output = new int[what.length];
for (int i = 0; i < what.length; i++) {
try {
output[i] = Integer.parseInt(what[i]);
@@ -9737,46 +9737,28 @@ public class PApplet implements PConstants {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
/*
static final public float[] parseFloat(boolean what[]) {
float floaties[] = new float[what.length];
for (int i = 0; i < what.length; i++) {
floaties[i] = what[i] ? 1 : 0;
}
return floaties;
}
static final public float[] parseFloat(char what[]) {
float floaties[] = new float[what.length];
for (int i = 0; i < what.length; i++) {
floaties[i] = (char) what[i];
}
return floaties;
}
*/
static final public float[] parseFloat(byte what[]) {
float floaties[] = new float[what.length];
static final public float[] parseFloat(byte[] what) {
float[] floaties = new float[what.length];
for (int i = 0; i < what.length; i++) {
floaties[i] = what[i];
}
return floaties;
}
static final public float[] parseFloat(int what[]) {
float floaties[] = new float[what.length];
static final public float[] parseFloat(int[] what) {
float[] floaties = new float[what.length];
for (int i = 0; i < what.length; i++) {
floaties[i] = what[i];
}
return floaties;
}
static final public float[] parseFloat(String what[]) {
static final public float[] parseFloat(String[] what) {
return parseFloat(what, Float.NaN);
}
static final public float[] parseFloat(String what[], float missing) {
float output[] = new float[what.length];
static final public float[] parseFloat(String[] what, float missing) {
float[] output = new float[what.length];
for (int i = 0; i < what.length; i++) {
try {
output[i] = Float.parseFloat(what[i]);
@@ -9811,32 +9793,32 @@ public class PApplet implements PConstants {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
static final public String[] str(boolean x[]) {
String s[] = new String[x.length];
static final public String[] str(boolean[] x) {
String[] s = new String[x.length];
for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]);
return s;
}
static final public String[] str(byte x[]) {
String s[] = new String[x.length];
static final public String[] str(byte[] x) {
String[] s = new String[x.length];
for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]);
return s;
}
static final public String[] str(char x[]) {
String s[] = new String[x.length];
static final public String[] str(char[] x) {
String[] s = new String[x.length];
for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]);
return s;
}
static final public String[] str(int x[]) {
String s[] = new String[x.length];
static final public String[] str(int[] x) {
String[] s = new String[x.length];
for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]);
return s;
}
static final public String[] str(float x[]) {
String s[] = new String[x.length];
static final public String[] str(float[] x) {
String[] s = new String[x.length];
for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]);
return s;
}
@@ -9893,8 +9875,8 @@ public class PApplet implements PConstants {
* @see <a href="https://processing.org/reference/intconvert_.html">int(float)</a>
*/
static public String[] nf(int nums[], int digits) {
String formatted[] = new String[nums.length];
static public String[] nf(int[] nums, int digits) {
String[] formatted = new String[nums.length];
for (int i = 0; i < formatted.length; i++) {
formatted[i] = nf(nums[i], digits);
}
@@ -9937,8 +9919,8 @@ public class PApplet implements PConstants {
* @see PApplet#nfp(float, int, int)
* @see PApplet#nfs(float, int, int)
*/
static public String[] nfc(int nums[]) {
String formatted[] = new String[nums.length];
static public String[] nfc(int[] nums) {
String[] formatted = new String[nums.length];
for (int i = 0; i < formatted.length; i++) {
formatted[i] = nfc(nums[i]);
}
@@ -9997,8 +9979,8 @@ public class PApplet implements PConstants {
/**
* @param nums the numbers to format
*/
static public String[] nfs(int nums[], int digits) {
String formatted[] = new String[nums.length];
static public String[] nfs(int[] nums, int digits) {
String[] formatted = new String[nums.length];
for (int i = 0; i < formatted.length; i++) {
formatted[i] = nfs(nums[i], digits);
}
@@ -10035,8 +10017,8 @@ public class PApplet implements PConstants {
/**
* @param nums the numbers to format
*/
static public String[] nfp(int nums[], int digits) {
String formatted[] = new String[nums.length];
static public String[] nfp(int[] nums, int digits) {
String[] formatted = new String[nums.length];
for (int i = 0; i < formatted.length; i++) {
formatted[i] = nfp(nums[i], digits);
}
@@ -10057,8 +10039,8 @@ public class PApplet implements PConstants {
* @param left number of digits to the left of the decimal point
* @param right number of digits to the right of the decimal point
*/
static public String[] nf(float nums[], int left, int right) {
String formatted[] = new String[nums.length];
static public String[] nf(float[] nums, int left, int right) {
String[] formatted = new String[nums.length];
for (int i = 0; i < formatted.length; i++) {
formatted[i] = nf(nums[i], left, right);
}
@@ -10090,8 +10072,8 @@ public class PApplet implements PConstants {
/**
* @param right number of digits to the right of the decimal point
*/
static public String[] nfc(float nums[], int right) {
String formatted[] = new String[nums.length];
static public String[] nfc(float[] nums, int right) {
String[] formatted = new String[nums.length];
for (int i = 0; i < formatted.length; i++) {
formatted[i] = nfc(nums[i], right);
}
@@ -10124,8 +10106,8 @@ public class PApplet implements PConstants {
* @param left the number of digits to the left of the decimal point
* @param right the number of digits to the right of the decimal point
*/
static public String[] nfs(float nums[], int left, int right) {
String formatted[] = new String[nums.length];
static public String[] nfs(float[] nums, int left, int right) {
String[] formatted = new String[nums.length];
for (int i = 0; i < formatted.length; i++) {
formatted[i] = nfs(nums[i], left, right);
}
@@ -10140,8 +10122,8 @@ public class PApplet implements PConstants {
* @param left the number of digits to the left of the decimal point
* @param right the number of digits to the right of the decimal point
*/
static public String[] nfp(float nums[], int left, int right) {
String formatted[] = new String[nums.length];
static public String[] nfp(float[] nums, int left, int right) {
String[] formatted = new String[nums.length];
for (int i = 0; i < formatted.length; i++) {
formatted[i] = nfp(nums[i], left, right);
}
+4 -4
View File
@@ -204,7 +204,7 @@ public class PFont implements PConstants {
* @nowebref
* @param charset array of all unicode chars that should be included
*/
public PFont(Font font, boolean smooth, char charset[]) {
public PFont(Font font, boolean smooth, char[] charset) {
// save this so that we can use the native version
this.font = font;
this.smooth = smooth;
@@ -329,7 +329,7 @@ public class PFont implements PConstants {
*
* @nowebref
*/
public PFont(Font font, boolean smooth, char charset[],
public PFont(Font font, boolean smooth, char[] charset,
boolean stream, int density) {
this(font, smooth, charset);
this.stream = stream;
@@ -865,7 +865,7 @@ public class PFont implements PConstants {
for (int i = 0; i < EXTRA_CHARS.length; i++) {
CHARSET[index++] = EXTRA_CHARS[i];
}
};
}
/**
@@ -885,7 +885,7 @@ public class PFont implements PConstants {
*/
static public String[] list() {
loadFonts();
String list[] = new String[fonts.length];
String[] list = new String[fonts.length];
for (int i = 0; i < list.length; i++) {
list[i] = fonts[i].getName();
}
+12 -10
View File
@@ -570,7 +570,7 @@ public class PGraphics extends PImage implements PConstants {
// vertices
public static final int DEFAULT_VERTICES = 512;
protected float vertices[][] =
protected float[][] vertices =
new float[DEFAULT_VERTICES][VERTEX_FIELD_COUNT];
protected int vertexCount; // total number of vertices
@@ -605,7 +605,7 @@ public class PGraphics extends PImage implements PConstants {
// spline vertices
protected float curveVertices[][];
protected float[][] curveVertices;
protected int curveVertexCount;
// ........................................................
@@ -618,8 +618,8 @@ public class PGraphics extends PImage implements PConstants {
// [toxi 031031]
// changed table's precision to 0.5 degree steps
// introduced new vars for more flexible code
static final protected float sinLUT[];
static final protected float cosLUT[];
static final protected float[] sinLUT;
static final protected float[] cosLUT;
static final protected float SINCOS_PRECISION = 0.5f;
static final protected int SINCOS_LENGTH = (int) (360f / SINCOS_PRECISION);
static {
@@ -702,7 +702,9 @@ public class PGraphics extends PImage implements PConstants {
// [toxi031031] new & faster sphere code w/ support flexible resolutions
// will be set by sphereDetail() or 1st call to sphere()
protected float sphereX[], sphereY[], sphereZ[];
protected float[] sphereX;
protected float[] sphereY;
protected float[] sphereZ;
/// Number of U steps (aka "theta") around longitudinally spanning 2*pi
public int sphereDetailU = 0;
@@ -1388,7 +1390,7 @@ public class PGraphics extends PImage implements PConstants {
protected void vertexCheck() {
if (vertexCount == vertices.length) {
float temp[][] = new float[vertexCount << 1][VERTEX_FIELD_COUNT];
float[][] temp = new float[vertexCount << 1][VERTEX_FIELD_COUNT];
System.arraycopy(vertices, 0, temp, 0, vertexCount);
vertices = temp;
}
@@ -1480,7 +1482,7 @@ public class PGraphics extends PImage implements PConstants {
// http://dev.processing.org/bugs/show_bug.cgi?id=444
if (shape == POLYGON) {
if (vertexCount > 0) {
float pvertex[] = vertices[vertexCount-1];
float[] pvertex = vertices[vertexCount-1];
if ((Math.abs(pvertex[X] - x) < EPSILON) &&
(Math.abs(pvertex[Y] - y) < EPSILON) &&
(Math.abs(pvertex[Z] - z) < EPSILON)) {
@@ -4551,7 +4553,7 @@ public class PGraphics extends PImage implements PConstants {
* Unlike the previous version that was inside PFont, this will
* return the size not of a 1 pixel font, but the actual current size.
*/
protected float textWidthImpl(char buffer[], int start, int stop) {
protected float textWidthImpl(char[] buffer, int start, int stop) {
float wide = 0;
for (int i = start; i < stop; i++) {
// could add kerning here, but it just ain't implemented
@@ -5019,7 +5021,7 @@ public class PGraphics extends PImage implements PConstants {
* Handles placement of a text line, then calls textLineImpl
* to actually render at the specific point.
*/
protected void textLineAlignImpl(char buffer[], int start, int stop,
protected void textLineAlignImpl(char[] buffer, int start, int stop,
float x, float y) {
if (textAlign == CENTER) {
x -= textWidthImpl(buffer, start, stop) / 2f;
@@ -5035,7 +5037,7 @@ public class PGraphics extends PImage implements PConstants {
/**
* Implementation of actual drawing for a line of text.
*/
protected void textLineImpl(char buffer[], int start, int stop,
protected void textLineImpl(char[] buffer, int start, int stop,
float x, float y) {
for (int index = start; index < stop; index++) {
textCharImpl(buffer[index], x, y);
+11 -11
View File
@@ -985,7 +985,7 @@ public class PImage implements PConstants, Cloneable {
* @param maskArray array of integers used as the alpha channel, needs to be
* the same length as the image's pixel array.
*/
public void mask(int maskArray[]) { // ignore
public void mask(int[] maskArray) { // ignore
loadPixels();
// don't execute if mask image is different size
if (maskArray.length != pixels.length) {
@@ -1284,7 +1284,7 @@ public class PImage implements PConstants, Cloneable {
protected void blurAlpha(float r) {
int sum, cb;
int read, ri, ym, ymi, bk0;
int b2[] = new int[pixels.length];
int[] b2 = new int[pixels.length];
int yi = 0;
buildBlurKernel(r);
@@ -1355,9 +1355,9 @@ public class PImage implements PConstants, Cloneable {
protected void blurRGB(float r) {
int sum, cr, cg, cb; //, k;
int /*pixel,*/ read, ri, /*roff,*/ ym, ymi, /*riw,*/ bk0;
int r2[] = new int[pixels.length];
int g2[] = new int[pixels.length];
int b2[] = new int[pixels.length];
int[] r2 = new int[pixels.length];
int[] g2 = new int[pixels.length];
int[] b2 = new int[pixels.length];
int yi = 0;
buildBlurKernel(r);
@@ -1438,10 +1438,10 @@ public class PImage implements PConstants, Cloneable {
int sum, cr, cg, cb, ca;
int /*pixel,*/ read, ri, /*roff,*/ ym, ymi, /*riw,*/ bk0;
int wh = pixels.length;
int r2[] = new int[wh];
int g2[] = new int[wh];
int b2[] = new int[wh];
int a2[] = new int[wh];
int[] r2 = new int[wh];
int[] g2 = new int[wh];
int[] b2 = new int[wh];
int[] a2 = new int[wh];
int yi = 0;
buildBlurKernel(r);
@@ -3048,7 +3048,7 @@ int testFunction(int dst, int src) {
}
*/
try {
byte tiff[] = new byte[768];
byte[] tiff = new byte[768];
System.arraycopy(TIFF_HEADER, 0, tiff, 0, TIFF_HEADER.length);
tiff[30] = (byte) ((pixelWidth >> 8) & 0xff);
@@ -3099,7 +3099,7 @@ int testFunction(int dst, int src) {
* <A HREF="http://www.wotsit.org/download.asp?f=tga">specification</A>
*/
protected boolean saveTGA(OutputStream output) {
byte header[] = new byte[18];
byte[] header = new byte[18];
if (format == ALPHA) { // save ALPHA images as 8bit grayscale
header[2] = 0x0B;
+1 -1
View File
@@ -381,7 +381,7 @@ public class PMatrix2D implements PMatrix {
* If out is null or not length four, a new float array will be returned.
* The values for vec and out can be the same (though that's less efficient).
*/
public float[] mult(float vec[], float out[]) {
public float[] mult(float[] vec, float[] out) {
if (out == null || out.length != 2) {
out = new float[2];
}
+1 -1
View File
@@ -327,7 +327,7 @@ public class PShapeOBJ extends PShape {
while ((line = reader.readLine()) != null) {
// Parse the line
line = line.trim();
String parts[] = line.split("\\s+");
String[] parts = line.split("\\s+");
if (parts.length > 0) {
// Extract the material data.
if (parts[0].equals("newmtl")) {
+3 -3
View File
@@ -1499,7 +1499,7 @@ public class PShapeSVG extends PShape {
public Gradient(PShapeSVG parent, XML properties) {
super(parent, properties, true);
XML elements[] = properties.getChildren();
XML[] elements = properties.getChildren();
offset = new float[elements.length];
color = new int[elements.length];
@@ -1555,7 +1555,7 @@ public class PShapeSVG extends PShape {
properties.getString("gradientTransform");
if (transformStr != null) {
float t[] = parseTransform(transformStr).get(null);
float[] t = parseTransform(transformStr).get(null);
this.transform = new AffineTransform(t[0], t[3], t[1], t[4], t[2], t[5]);
Point2D t1 = transform.transform(new Point2D.Float(x1, y1), null);
@@ -1587,7 +1587,7 @@ public class PShapeSVG extends PShape {
properties.getString("gradientTransform");
if (transformStr != null) {
float t[] = parseTransform(transformStr).get(null);
float[] t = parseTransform(transformStr).get(null);
this.transform = new AffineTransform(t[0], t[3], t[1], t[4], t[2], t[5]);
Point2D t1 = transform.transform(new Point2D.Float(cx, cy), null);
+5 -5
View File
@@ -1718,19 +1718,19 @@ public class Table {
columns[column] = new int[rowCount];
break;
case LONG:
columns[column] = new long[rowCount];;
columns[column] = new long[rowCount];
break;
case FLOAT:
columns[column] = new float[rowCount];;
columns[column] = new float[rowCount];
break;
case DOUBLE:
columns[column] = new double[rowCount];;
columns[column] = new double[rowCount];
break;
case STRING:
columns[column] = new String[rowCount];;
columns[column] = new String[rowCount];
break;
case CATEGORY:
columns[column] = new int[rowCount];;
columns[column] = new int[rowCount];
break;
default:
throw new IllegalArgumentException(newType + " is not a valid column type.");
@@ -67,7 +67,7 @@ public class PGraphicsFX2D extends PGraphics {
/// break the shape at the next vertex (next vertex() call is a moveto())
boolean breakShape;
private float pathCoordsBuffer[] = new float[6];
private float[] pathCoordsBuffer = new float[6];
/// coordinates for internal curve calculation
float[] curveCoordX;
@@ -76,7 +76,7 @@ public class PGraphicsFX2D extends PGraphics {
float[] curveDrawY;
int transformCount;
Affine transformStack[] = new Affine[MATRIX_STACK_DEPTH];
Affine[] transformStack = new Affine[MATRIX_STACK_DEPTH];
// Line2D.Float line = new Line2D.Float();
// Ellipse2D.Float ellipse = new Ellipse2D.Float();
@@ -239,7 +239,7 @@ public class PGraphicsFX2D extends PGraphics {
@Override
public void vertex(float x, float y) {
if (vertexCount == vertices.length) {
float temp[][] = new float[vertexCount<<1][VERTEX_FIELD_COUNT];
float[][] temp = new float[vertexCount<<1][VERTEX_FIELD_COUNT];
System.arraycopy(vertices, 0, temp, 0, vertexCount);
vertices = temp;
//message(CHATTER, "allocating more vertices " + vertices.length);
+3 -3
View File
@@ -324,7 +324,7 @@ public class LinePath {
static public class PathIterator {
float floatCoords[];
float[] floatCoords;
int typeIdx;
@@ -334,7 +334,7 @@ public class LinePath {
LinePath path;
static final int curvecoords[] = { 2, 2, 0 };
static final int[] curvecoords = { 2, 2, 0 };
PathIterator(LinePath p2df) {
this.path = p2df;
@@ -470,7 +470,7 @@ public class LinePath {
private static void pathTo(PathIterator pi, LineStroker lsink) {
float coords[] = new float[6];
float[] coords = new float[6];
while (!pi.isDone()) {
int color;
switch (pi.currentSegment(coords)) {
+2 -2
View File
@@ -486,7 +486,7 @@ public abstract class PGL {
}
protected boolean isFBOBacked() {;
protected boolean isFBOBacked() {
return fboLayerEnabled;
}
@@ -2140,7 +2140,7 @@ public abstract class PGL {
String[] parts = version.split(" ");
for (int i = 0; i < parts.length; i++) {
if (0 < parts[i].indexOf(".")) {
String nums[] = parts[i].split("\\.");
String[] nums = parts[i].split("\\.");
try {
res[0] = Integer.parseInt(nums[0]);
} catch (NumberFormatException e) { }
+82 -82
View File
@@ -2365,8 +2365,8 @@ public class PGraphicsOpenGL extends PGraphics {
protected void flushPolys() {
boolean customShader = polyShader != null;
boolean needNormals = customShader ? polyShader.accessNormals() : false;
boolean needTexCoords = customShader ? polyShader.accessTexCoords() : false;
boolean needNormals = customShader && polyShader.accessNormals();
boolean needTexCoords = customShader && polyShader.accessTexCoords();
updatePolyBuffers(lights, texCache.hasTextures, needNormals, needTexCoords);
@@ -2438,8 +2438,8 @@ public class PGraphicsOpenGL extends PGraphics {
protected void flushSortedPolys() {
boolean customShader = polyShader != null;
boolean needNormals = customShader ? polyShader.accessNormals() : false;
boolean needTexCoords = customShader ? polyShader.accessTexCoords() : false;
boolean needNormals = customShader && polyShader.accessNormals();
boolean needTexCoords = customShader && polyShader.accessTexCoords();
sorter.sort(tessGeo);
@@ -3485,7 +3485,7 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
protected float textWidthImpl(char buffer[], int start, int stop) {
protected float textWidthImpl(char[] buffer, int start, int stop) {
if (textFont == null) defaultFontOrDeath("textWidth");
Object font = textFont.getNative();
float twidth = 0;
@@ -3510,7 +3510,7 @@ public class PGraphicsOpenGL extends PGraphics {
* Implementation of actual drawing for a line of text.
*/
@Override
protected void textLineImpl(char buffer[], int start, int stop,
protected void textLineImpl(char[] buffer, int start, int stop,
float x, float y) {
if (textMode == SHAPE && textFont.getNative() == null) {
@@ -3654,7 +3654,7 @@ public class PGraphicsOpenGL extends PGraphics {
PGL.FontOutline outline = pgl.createFontOutline(ch, textFont.getNative());
// six element array received from the Java2D path iterator
float textPoints[] = new float[6];
float[] textPoints = new float[6];
float lastX = 0;
float lastY = 0;
@@ -7899,61 +7899,61 @@ public class PGraphicsOpenGL extends PGraphics {
// Expand arrays
void expandVertices(int n) {
float temp[] = new float[3 * n];
float[] temp = new float[3 * n];
PApplet.arrayCopy(vertices, 0, temp, 0, 3 * vertexCount);
vertices = temp;
}
void expandColors(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(colors, 0, temp, 0, vertexCount);
colors = temp;
}
void expandNormals(int n) {
float temp[] = new float[3 * n];
float[] temp = new float[3 * n];
PApplet.arrayCopy(normals, 0, temp, 0, 3 * vertexCount);
normals = temp;
}
void expandTexCoords(int n) {
float temp[] = new float[2 * n];
float[] temp = new float[2 * n];
PApplet.arrayCopy(texcoords, 0, temp, 0, 2 * vertexCount);
texcoords = temp;
}
void expandStrokeColors(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(strokeColors, 0, temp, 0, vertexCount);
strokeColors = temp;
}
void expandStrokeWeights(int n) {
float temp[] = new float[n];
float[] temp = new float[n];
PApplet.arrayCopy(strokeWeights, 0, temp, 0, vertexCount);
strokeWeights = temp;
}
void expandAmbient(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(ambient, 0, temp, 0, vertexCount);
ambient = temp;
}
void expandSpecular(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(specular, 0, temp, 0, vertexCount);
specular = temp;
}
void expandEmissive(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(emissive, 0, temp, 0, vertexCount);
emissive = temp;
}
void expandShininess(int n) {
float temp[] = new float[n];
float[] temp = new float[n];
PApplet.arrayCopy(shininess, 0, temp, 0, vertexCount);
shininess = temp;
}
@@ -7973,33 +7973,33 @@ public class PGraphicsOpenGL extends PGraphics {
void expandFloatAttrib(VertexAttribute attrib, int n) {
float[] values = fattribs.get(attrib.name);
float temp[] = new float[attrib.size * n];
float[] temp = new float[attrib.size * n];
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
fattribs.put(attrib.name, temp);
}
void expandIntAttrib(VertexAttribute attrib, int n) {
int[] values = iattribs.get(attrib.name);
int temp[] = new int[attrib.size * n];
int[] temp = new int[attrib.size * n];
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
iattribs.put(attrib.name, temp);
}
void expandBoolAttrib(VertexAttribute attrib, int n) {
byte[] values = battribs.get(attrib.name);
byte temp[] = new byte[attrib.size * n];
byte[] temp = new byte[attrib.size * n];
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
battribs.put(attrib.name, temp);
}
void expandCodes(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(codes, 0, temp, 0, codeCount);
codes = temp;
}
void expandEdges(int n) {
int temp[][] = new int[n][3];
int[][] temp = new int[n][3];
PApplet.arrayCopy(edges, 0, temp, 0, edgeCount);
edges = temp;
}
@@ -8033,73 +8033,73 @@ public class PGraphicsOpenGL extends PGraphics {
}
void trimVertices() {
float temp[] = new float[3 * vertexCount];
float[] temp = new float[3 * vertexCount];
PApplet.arrayCopy(vertices, 0, temp, 0, 3 * vertexCount);
vertices = temp;
}
void trimColors() {
int temp[] = new int[vertexCount];
int[] temp = new int[vertexCount];
PApplet.arrayCopy(colors, 0, temp, 0, vertexCount);
colors = temp;
}
void trimNormals() {
float temp[] = new float[3 * vertexCount];
float[] temp = new float[3 * vertexCount];
PApplet.arrayCopy(normals, 0, temp, 0, 3 * vertexCount);
normals = temp;
}
void trimTexCoords() {
float temp[] = new float[2 * vertexCount];
float[] temp = new float[2 * vertexCount];
PApplet.arrayCopy(texcoords, 0, temp, 0, 2 * vertexCount);
texcoords = temp;
}
void trimStrokeColors() {
int temp[] = new int[vertexCount];
int[] temp = new int[vertexCount];
PApplet.arrayCopy(strokeColors, 0, temp, 0, vertexCount);
strokeColors = temp;
}
void trimStrokeWeights() {
float temp[] = new float[vertexCount];
float[] temp = new float[vertexCount];
PApplet.arrayCopy(strokeWeights, 0, temp, 0, vertexCount);
strokeWeights = temp;
}
void trimAmbient() {
int temp[] = new int[vertexCount];
int[] temp = new int[vertexCount];
PApplet.arrayCopy(ambient, 0, temp, 0, vertexCount);
ambient = temp;
}
void trimSpecular() {
int temp[] = new int[vertexCount];
int[] temp = new int[vertexCount];
PApplet.arrayCopy(specular, 0, temp, 0, vertexCount);
specular = temp;
}
void trimEmissive() {
int temp[] = new int[vertexCount];
int[] temp = new int[vertexCount];
PApplet.arrayCopy(emissive, 0, temp, 0, vertexCount);
emissive = temp;
}
void trimShininess() {
float temp[] = new float[vertexCount];
float[] temp = new float[vertexCount];
PApplet.arrayCopy(shininess, 0, temp, 0, vertexCount);
shininess = temp;
}
void trimCodes() {
int temp[] = new int[codeCount];
int[] temp = new int[codeCount];
PApplet.arrayCopy(codes, 0, temp, 0, codeCount);
codes = temp;
}
void trimEdges() {
int temp[][] = new int[edgeCount][3];
int[][] temp = new int[edgeCount][3];
PApplet.arrayCopy(edges, 0, temp, 0, edgeCount);
edges = temp;
}
@@ -8119,21 +8119,21 @@ public class PGraphicsOpenGL extends PGraphics {
void trimFloatAttrib(VertexAttribute attrib) {
float[] values = fattribs.get(attrib.name);
float temp[] = new float[attrib.size * vertexCount];
float[] temp = new float[attrib.size * vertexCount];
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
fattribs.put(attrib.name, temp);
}
void trimIntAttrib(VertexAttribute attrib) {
int[] values = iattribs.get(attrib.name);
int temp[] = new int[attrib.size * vertexCount];
int[] temp = new int[attrib.size * vertexCount];
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
iattribs.put(attrib.name, temp);
}
void trimBoolAttrib(VertexAttribute attrib) {
byte[] values = battribs.get(attrib.name);
byte temp[] = new byte[attrib.size * vertexCount];
byte[] temp = new byte[attrib.size * vertexCount];
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
battribs.put(attrib.name, temp);
}
@@ -9675,56 +9675,56 @@ public class PGraphicsOpenGL extends PGraphics {
// Expand arrays
void expandPolyVertices(int n) {
float temp[] = new float[4 * n];
float[] temp = new float[4 * n];
PApplet.arrayCopy(polyVertices, 0, temp, 0, 4 * polyVertexCount);
polyVertices = temp;
polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices);
}
void expandPolyColors(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(polyColors, 0, temp, 0, polyVertexCount);
polyColors = temp;
polyColorsBuffer = PGL.allocateIntBuffer(polyColors);
}
void expandPolyNormals(int n) {
float temp[] = new float[3 * n];
float[] temp = new float[3 * n];
PApplet.arrayCopy(polyNormals, 0, temp, 0, 3 * polyVertexCount);
polyNormals = temp;
polyNormalsBuffer = PGL.allocateFloatBuffer(polyNormals);
}
void expandPolyTexCoords(int n) {
float temp[] = new float[2 * n];
float[] temp = new float[2 * n];
PApplet.arrayCopy(polyTexCoords, 0, temp, 0, 2 * polyVertexCount);
polyTexCoords = temp;
polyTexCoordsBuffer = PGL.allocateFloatBuffer(polyTexCoords);
}
void expandPolyAmbient(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(polyAmbient, 0, temp, 0, polyVertexCount);
polyAmbient = temp;
polyAmbientBuffer = PGL.allocateIntBuffer(polyAmbient);
}
void expandPolySpecular(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(polySpecular, 0, temp, 0, polyVertexCount);
polySpecular = temp;
polySpecularBuffer = PGL.allocateIntBuffer(polySpecular);
}
void expandPolyEmissive(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(polyEmissive, 0, temp, 0, polyVertexCount);
polyEmissive = temp;
polyEmissiveBuffer = PGL.allocateIntBuffer(polyEmissive);
}
void expandPolyShininess(int n) {
float temp[] = new float[n];
float[] temp = new float[n];
PApplet.arrayCopy(polyShininess, 0, temp, 0, polyVertexCount);
polyShininess = temp;
polyShininessBuffer = PGL.allocateFloatBuffer(polyShininess);
@@ -9745,7 +9745,7 @@ public class PGraphicsOpenGL extends PGraphics {
void expandFloatAttribute(VertexAttribute attrib, int n) {
float[] array = fpolyAttribs.get(attrib.name);
float temp[] = new float[attrib.tessSize * n];
float[] temp = new float[attrib.tessSize * n];
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
fpolyAttribs.put(attrib.name, temp);
polyAttribBuffers.put(attrib.name, PGL.allocateFloatBuffer(temp));
@@ -9753,7 +9753,7 @@ public class PGraphicsOpenGL extends PGraphics {
void expandIntAttribute(VertexAttribute attrib, int n) {
int[] array = ipolyAttribs.get(attrib.name);
int temp[] = new int[attrib.tessSize * n];
int[] temp = new int[attrib.tessSize * n];
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
ipolyAttribs.put(attrib.name, temp);
polyAttribBuffers.put(attrib.name, PGL.allocateIntBuffer(temp));
@@ -9761,70 +9761,70 @@ public class PGraphicsOpenGL extends PGraphics {
void expandBoolAttribute(VertexAttribute attrib, int n) {
byte[] array = bpolyAttribs.get(attrib.name);
byte temp[] = new byte[attrib.tessSize * n];
byte[] temp = new byte[attrib.tessSize * n];
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
bpolyAttribs.put(attrib.name, temp);
polyAttribBuffers.put(attrib.name, PGL.allocateByteBuffer(temp));
}
void expandPolyIndices(int n) {
short temp[] = new short[n];
short[] temp = new short[n];
PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount);
polyIndices = temp;
polyIndicesBuffer = PGL.allocateShortBuffer(polyIndices);
}
void expandLineVertices(int n) {
float temp[] = new float[4 * n];
float[] temp = new float[4 * n];
PApplet.arrayCopy(lineVertices, 0, temp, 0, 4 * lineVertexCount);
lineVertices = temp;
lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices);
}
void expandLineColors(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(lineColors, 0, temp, 0, lineVertexCount);
lineColors = temp;
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
}
void expandLineDirections(int n) {
float temp[] = new float[4 * n];
float[] temp = new float[4 * n];
PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
lineDirections = temp;
lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
}
void expandLineIndices(int n) {
short temp[] = new short[n];
short[] temp = new short[n];
PApplet.arrayCopy(lineIndices, 0, temp, 0, lineIndexCount);
lineIndices = temp;
lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices);
}
void expandPointVertices(int n) {
float temp[] = new float[4 * n];
float[] temp = new float[4 * n];
PApplet.arrayCopy(pointVertices, 0, temp, 0, 4 * pointVertexCount);
pointVertices = temp;
pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices);
}
void expandPointColors(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(pointColors, 0, temp, 0, pointVertexCount);
pointColors = temp;
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
}
void expandPointOffsets(int n) {
float temp[] = new float[2 * n];
float[] temp = new float[2 * n];
PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
pointOffsets = temp;
pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
}
void expandPointIndices(int n) {
short temp[] = new short[n];
short[] temp = new short[n];
PApplet.arrayCopy(pointIndices, 0, temp, 0, pointIndexCount);
pointIndices = temp;
pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices);
@@ -9873,56 +9873,56 @@ public class PGraphicsOpenGL extends PGraphics {
}
void trimPolyVertices() {
float temp[] = new float[4 * polyVertexCount];
float[] temp = new float[4 * polyVertexCount];
PApplet.arrayCopy(polyVertices, 0, temp, 0, 4 * polyVertexCount);
polyVertices = temp;
polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices);
}
void trimPolyColors() {
int temp[] = new int[polyVertexCount];
int[] temp = new int[polyVertexCount];
PApplet.arrayCopy(polyColors, 0, temp, 0, polyVertexCount);
polyColors = temp;
polyColorsBuffer = PGL.allocateIntBuffer(polyColors);
}
void trimPolyNormals() {
float temp[] = new float[3 * polyVertexCount];
float[] temp = new float[3 * polyVertexCount];
PApplet.arrayCopy(polyNormals, 0, temp, 0, 3 * polyVertexCount);
polyNormals = temp;
polyNormalsBuffer = PGL.allocateFloatBuffer(polyNormals);
}
void trimPolyTexCoords() {
float temp[] = new float[2 * polyVertexCount];
float[] temp = new float[2 * polyVertexCount];
PApplet.arrayCopy(polyTexCoords, 0, temp, 0, 2 * polyVertexCount);
polyTexCoords = temp;
polyTexCoordsBuffer = PGL.allocateFloatBuffer(polyTexCoords);
}
void trimPolyAmbient() {
int temp[] = new int[polyVertexCount];
int[] temp = new int[polyVertexCount];
PApplet.arrayCopy(polyAmbient, 0, temp, 0, polyVertexCount);
polyAmbient = temp;
polyAmbientBuffer = PGL.allocateIntBuffer(polyAmbient);
}
void trimPolySpecular() {
int temp[] = new int[polyVertexCount];
int[] temp = new int[polyVertexCount];
PApplet.arrayCopy(polySpecular, 0, temp, 0, polyVertexCount);
polySpecular = temp;
polySpecularBuffer = PGL.allocateIntBuffer(polySpecular);
}
void trimPolyEmissive() {
int temp[] = new int[polyVertexCount];
int[] temp = new int[polyVertexCount];
PApplet.arrayCopy(polyEmissive, 0, temp, 0, polyVertexCount);
polyEmissive = temp;
polyEmissiveBuffer = PGL.allocateIntBuffer(polyEmissive);
}
void trimPolyShininess() {
float temp[] = new float[polyVertexCount];
float[] temp = new float[polyVertexCount];
PApplet.arrayCopy(polyShininess, 0, temp, 0, polyVertexCount);
polyShininess = temp;
polyShininessBuffer = PGL.allocateFloatBuffer(polyShininess);
@@ -9943,7 +9943,7 @@ public class PGraphicsOpenGL extends PGraphics {
void trimFloatAttribute(VertexAttribute attrib) {
float[] array = fpolyAttribs.get(attrib.name);
float temp[] = new float[attrib.tessSize * polyVertexCount];
float[] temp = new float[attrib.tessSize * polyVertexCount];
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
fpolyAttribs.put(attrib.name, temp);
polyAttribBuffers.put(attrib.name, PGL.allocateFloatBuffer(temp));
@@ -9951,7 +9951,7 @@ public class PGraphicsOpenGL extends PGraphics {
void trimIntAttribute(VertexAttribute attrib) {
int[] array = ipolyAttribs.get(attrib.name);
int temp[] = new int[attrib.tessSize * polyVertexCount];
int[] temp = new int[attrib.tessSize * polyVertexCount];
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
ipolyAttribs.put(attrib.name, temp);
polyAttribBuffers.put(attrib.name, PGL.allocateIntBuffer(temp));
@@ -9959,70 +9959,70 @@ public class PGraphicsOpenGL extends PGraphics {
void trimBoolAttribute(VertexAttribute attrib) {
byte[] array = bpolyAttribs.get(attrib.name);
byte temp[] = new byte[attrib.tessSize * polyVertexCount];
byte[] temp = new byte[attrib.tessSize * polyVertexCount];
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
bpolyAttribs.put(attrib.name, temp);
polyAttribBuffers.put(attrib.name, PGL.allocateByteBuffer(temp));
}
void trimPolyIndices() {
short temp[] = new short[polyIndexCount];
short[] temp = new short[polyIndexCount];
PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount);
polyIndices = temp;
polyIndicesBuffer = PGL.allocateShortBuffer(polyIndices);
}
void trimLineVertices() {
float temp[] = new float[4 * lineVertexCount];
float[] temp = new float[4 * lineVertexCount];
PApplet.arrayCopy(lineVertices, 0, temp, 0, 4 * lineVertexCount);
lineVertices = temp;
lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices);
}
void trimLineColors() {
int temp[] = new int[lineVertexCount];
int[] temp = new int[lineVertexCount];
PApplet.arrayCopy(lineColors, 0, temp, 0, lineVertexCount);
lineColors = temp;
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
}
void trimLineDirections() {
float temp[] = new float[4 * lineVertexCount];
float[] temp = new float[4 * lineVertexCount];
PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
lineDirections = temp;
lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
}
void trimLineIndices() {
short temp[] = new short[lineIndexCount];
short[] temp = new short[lineIndexCount];
PApplet.arrayCopy(lineIndices, 0, temp, 0, lineIndexCount);
lineIndices = temp;
lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices);
}
void trimPointVertices() {
float temp[] = new float[4 * pointVertexCount];
float[] temp = new float[4 * pointVertexCount];
PApplet.arrayCopy(pointVertices, 0, temp, 0, 4 * pointVertexCount);
pointVertices = temp;
pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices);
}
void trimPointColors() {
int temp[] = new int[pointVertexCount];
int[] temp = new int[pointVertexCount];
PApplet.arrayCopy(pointColors, 0, temp, 0, pointVertexCount);
pointColors = temp;
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
}
void trimPointOffsets() {
float temp[] = new float[2 * pointVertexCount];
float[] temp = new float[2 * pointVertexCount];
PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
pointOffsets = temp;
pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
}
void trimPointIndices() {
short temp[] = new short[pointIndexCount];
short[] temp = new short[pointIndexCount];
PApplet.arrayCopy(pointIndices, 0, temp, 0, pointIndexCount);
pointIndices = temp;
pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices);
@@ -12448,7 +12448,7 @@ public class PGraphicsOpenGL extends PGraphics {
if (dupIndices.length == dupCount) {
int n = dupCount << 1;
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(dupIndices, 0, temp, 0, dupCount);
dupIndices = temp;
}
@@ -12495,7 +12495,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
void expandRawIndices(int n) {
int temp[] = new int[n];
int[] temp = new int[n];
PApplet.arrayCopy(rawIndices, 0, temp, 0, rawSize);
rawIndices = temp;
}
@@ -12940,15 +12940,15 @@ public class PGraphicsOpenGL extends PGraphics {
if (pathVertexCount == pathVertices.length / 3) {
int newSize = pathVertexCount << 1;
float vtemp[] = new float[3 * newSize];
float[] vtemp = new float[3 * newSize];
PApplet.arrayCopy(pathVertices, 0, vtemp, 0, 3 * pathVertexCount);
pathVertices = vtemp;
int ctemp[] = new int[newSize];
int[] ctemp = new int[newSize];
PApplet.arrayCopy(pathColors, 0, ctemp, 0, pathVertexCount);
pathColors = ctemp;
float wtemp[] = new float[newSize];
float[] wtemp = new float[newSize];
PApplet.arrayCopy(pathWeights, 0, wtemp, 0, pathVertexCount);
pathWeights = wtemp;
}
+2 -2
View File
@@ -722,7 +722,7 @@ public class PJOGL extends PGL {
PathIterator iter;
public FontOutline(char ch, Font font) {
char textArray[] = new char[] { ch };
char[] textArray = new char[] { ch };
FontRenderContext frc = getFontRenderContext(font);
GlyphVector gv = font.createGlyphVector(frc, textArray);
Shape shp = gv.getOutline();
@@ -733,7 +733,7 @@ public class PJOGL extends PGL {
return iter.isDone();
}
public int currentSegment(float coords[]) {
public int currentSegment(float[] coords) {
return iter.currentSegment(coords);
}