Skip to content

Commit aeb6f07

Browse files
committed
cleaning up some random casting warnings
1 parent 0107f78 commit aeb6f07

9 files changed

Lines changed: 35 additions & 23 deletions

File tree

core/src/processing/core/PApplet.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ public void stop() {
926926
* when moving between pages), though.
927927
*/
928928
public void destroy() {
929-
((PApplet) this).dispose();
929+
this.dispose();
930930
}
931931

932932

@@ -4054,7 +4054,7 @@ static public final int floor(float what) {
40544054
* @see PApplet#ceil(float)
40554055
*/
40564056
static public final int round(float what) {
4057-
return (int) Math.round(what);
4057+
return Math.round(what);
40584058
}
40594059

40604060

@@ -4365,9 +4365,9 @@ public float noise(float x, float y, float z) {
43654365
if (z<0) z=-z;
43664366

43674367
int xi=(int)x, yi=(int)y, zi=(int)z;
4368-
float xf = (float)(x-xi);
4369-
float yf = (float)(y-yi);
4370-
float zf = (float)(z-zi);
4368+
float xf = x - xi;
4369+
float yf = y - yi;
4370+
float zf = z - zi;
43714371
float rxf, ryf;
43724372

43734373
float r=0;
@@ -7512,7 +7512,7 @@ static public String[][] matchAll(String what, String regexp) {
75127512
}
75137513
String[][] matches = new String[results.size()][count];
75147514
for (int i = 0; i < matches.length; i++) {
7515-
matches[i] = (String[]) results.get(i);
7515+
matches[i] = results.get(i);
75167516
}
75177517
return matches;
75187518
}
@@ -7897,7 +7897,7 @@ static final public float parseFloat(boolean what) {
78977897
* Java's rules for upgrading values.
78987898
*/
78997899
static final public float parseFloat(int what) { // also handles byte
7900-
return (float)what;
7900+
return what;
79017901
}
79027902

79037903
static final public float parseFloat(String what) {

core/src/processing/core/PGraphics.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,8 +1338,8 @@ protected void vertexTexture(float u, float v) {
13381338
"using u and v coordinates with vertex()");
13391339
}
13401340
if (textureMode == IMAGE) {
1341-
u /= (float) textureImage.width;
1342-
v /= (float) textureImage.height;
1341+
u /= textureImage.width;
1342+
v /= textureImage.height;
13431343
}
13441344

13451345
textureU = u;
@@ -6615,10 +6615,10 @@ protected void colorCalcARGB(int argb, float alpha) {
66156615
calcRi = (argb >> 16) & 0xff;
66166616
calcGi = (argb >> 8) & 0xff;
66176617
calcBi = argb & 0xff;
6618-
calcA = (float)calcAi / 255.0f;
6619-
calcR = (float)calcRi / 255.0f;
6620-
calcG = (float)calcGi / 255.0f;
6621-
calcB = (float)calcBi / 255.0f;
6618+
calcA = calcAi / 255.0f;
6619+
calcR = calcRi / 255.0f;
6620+
calcG = calcGi / 255.0f;
6621+
calcB = calcBi / 255.0f;
66226622
calcAlpha = (calcAi != 255);
66236623
}
66246624

core/src/processing/core/PImage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,8 +1839,8 @@ private void blit_resize(PImage img,
18391839
int dx = (int) (srcW / (float) destW * PRECISIONF);
18401840
int dy = (int) (srcH / (float) destH * PRECISIONF);
18411841

1842-
srcXOffset = (int) (destX1 < 0 ? -destX1 * dx : srcX1 * PRECISIONF);
1843-
srcYOffset = (int) (destY1 < 0 ? -destY1 * dy : srcY1 * PRECISIONF);
1842+
srcXOffset = destX1 < 0 ? -destX1 * dx : srcX1 * PRECISIONF;
1843+
srcYOffset = destY1 < 0 ? -destY1 * dy : srcY1 * PRECISIONF;
18441844

18451845
if (destX1 < 0) {
18461846
destW += destX1;

core/src/processing/core/PShape.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ public void applyMatrix(PMatrix source) {
12201220
if (source instanceof PMatrix2D) {
12211221
applyMatrix((PMatrix2D) source);
12221222
} else if (source instanceof PMatrix3D) {
1223-
applyMatrix((PMatrix3D) source);
1223+
applyMatrix(source);
12241224
}
12251225
}
12261226

core/src/processing/core/PShapeSVG.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,15 +1696,15 @@ public void drawString(PGraphics g, String str, float x, float y, float size) {
16961696
// 1) scale by the 1.0/unitsPerEm
16971697
// 2) scale up by a font size
16981698
g.pushMatrix();
1699-
float s = size / (float) face.unitsPerEm;
1699+
float s = size / face.unitsPerEm;
17001700
//System.out.println("scale is " + s);
17011701
// swap y coord at the same time, since fonts have y=0 at baseline
17021702
g.translate(x, y);
17031703
g.scale(s, -s);
17041704
char[] c = str.toCharArray();
17051705
for (int i = 0; i < c.length; i++) {
17061706
// call draw on each char (pulling it w/ the unicode table)
1707-
FontGlyph fg = (FontGlyph) unicodeGlyphs.get(new Character(c[i]));
1707+
FontGlyph fg = unicodeGlyphs.get(new Character(c[i]));
17081708
if (fg != null) {
17091709
fg.draw(g);
17101710
// add horizAdvX/unitsPerEm to the x coordinate along the way
@@ -1719,10 +1719,10 @@ public void drawString(PGraphics g, String str, float x, float y, float size) {
17191719

17201720
public void drawChar(PGraphics g, char c, float x, float y, float size) {
17211721
g.pushMatrix();
1722-
float s = size / (float) face.unitsPerEm;
1722+
float s = size / face.unitsPerEm;
17231723
g.translate(x, y);
17241724
g.scale(s, -s);
1725-
FontGlyph fg = (FontGlyph) unicodeGlyphs.get(new Character(c));
1725+
FontGlyph fg = unicodeGlyphs.get(new Character(c));
17261726
if (fg != null) g.shape(fg);
17271727
g.popMatrix();
17281728
}
@@ -1733,7 +1733,7 @@ public float textWidth(String str, float size) {
17331733
char[] c = str.toCharArray();
17341734
for (int i = 0; i < c.length; i++) {
17351735
// call draw on each char (pulling it w/ the unicode table)
1736-
FontGlyph fg = (FontGlyph) unicodeGlyphs.get(new Character(c[i]));
1736+
FontGlyph fg = unicodeGlyphs.get(new Character(c[i]));
17371737
if (fg != null) {
17381738
w += (float) fg.horizAdvX / face.unitsPerEm;
17391739
}

core/src/processing/core/Table.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ protected int getColumnIndex(String name, boolean report) {
809809
columnIndices.put(columnTitles[col], col);
810810
}
811811
}
812-
Integer index = (Integer) columnIndices.get(name);
812+
Integer index = columnIndices.get(name);
813813
if (index == null) {
814814
if (report) {
815815
System.err.println("No column named '" + name + "' was found.");

core/src/processing/core/XML.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ protected XML[] getChildrenRecursive(String[] items, int offset) {
353353
if (offset == items.length-1) {
354354
return getChildren(items[offset]);
355355
}
356-
XML[] matches = (XML[]) getChildren(items[offset]);
356+
XML[] matches = getChildren(items[offset]);
357357
XML[] outgoing = new XML[0];
358358
for (int i = 0; i < matches.length; i++) {
359359
XML[] kidMatches = matches[i].getChildrenRecursive(items, offset+1);

core/todo.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
X remove textMode(SCREEN)
33
X added expand(long) and expand(double) because of Table
44

5+
_ boolean sketchFullscreen() ?
6+
_ for more options, just integrate the fs library?
7+
_ http://www.superduper.org/processing/fullscreen_api/
8+
_ https://github.com/kritzikratzi/jAppleMenuBar/blob/master/src/native/jAppleMenuBar.m
9+
10+
_ update wiki re: PNode... also include notes about the changes
11+
_ add note about textMode(SCREEN) to the wiki
12+
SCREEN was a super fast/efficient way of rendering text with P2D and P3D, but since they're going bye-bye and it's actually slower in the remaining renderers, it's going away.
13+
514
_ PImage.save() with full path raises exception
615
_ http://code.google.com/p/processing/issues/detail?id=808
716
_ if save() returns boolean, does saveFrame()?

todo.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ X re-upload with new version to include javac
44
X HTML escapes for < and > not working properly
55
X http://code.google.com/p/processing/issues/detail?id=771
66

7+
_ --bgcolor shouldn't be in main() unless 'present' is turned on
8+
_ also add option for FSEM or not
9+
710
_ library imports failing for libs that define the same packages in 1.5.1
811
_ http://code.google.com/p/processing/issues/detail?id=725
912

0 commit comments

Comments
 (0)