summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
authorRami Santina <[email protected]>2011-05-21 17:49:08 +0300
committerRami Santina <[email protected]>2011-05-21 17:49:08 +0300
commit5ea211cde39be9669d1f2f289abbba460398f82e (patch)
tree79a3db238a55faa6aebad7493e772065c69411b5 /src/jogl/classes/jogamp
parent9e599f84bc02ef2db63b6eb1cadfa33f56dddd66 (diff)
Remove implicit for loops reduces temp objects
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java9
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/Loop.java10
-rw-r--r--src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java1
4 files changed, 13 insertions, 11 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
index 6a2f47c79..c8251af15 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
@@ -47,8 +47,8 @@ public class GraphOutline {
public GraphOutline(Outline ol){
this.outline = ol;
ArrayList<Vertex> vertices = this.outline.getVertices();
- for(Vertex v:vertices){
- this.controlpoints.add(new GraphVertex(v));
+ for(int i = 0; i< vertices.size(); i++){
+ this.controlpoints.add(new GraphVertex(vertices.get(i)));
}
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
index 5efe57c28..52d02baa5 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
@@ -86,7 +86,8 @@ public class GraphVertex {
}
}
public HEdge findNextEdge(GraphVertex nextVert){
- for(HEdge e:edges){
+ for(int i=0; i<edges.size(); i++) {
+ HEdge e = edges.get(i);
if(e.getNext().getGraphPoint() == nextVert){
return e;
}
@@ -94,7 +95,8 @@ public class GraphVertex {
return null;
}
public HEdge findBoundEdge(){
- for(HEdge e:edges){
+ for(int i=0; i<edges.size(); i++) {
+ HEdge e = edges.get(i);
if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){
return e;
}
@@ -102,7 +104,8 @@ public class GraphVertex {
return null;
}
public HEdge findPrevEdge(GraphVertex prevVert){
- for(HEdge e:edges){
+ for(int i=0; i<edges.size(); i++) {
+ HEdge e = edges.get(i);
if(e.getPrev().getGraphPoint() == prevVert){
return e;
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
index a511ed26e..b4b796b51 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
@@ -106,13 +106,10 @@ public class Loop {
vertices.get(0).getPoint(),
vertices.get(1).getPoint(),
vertices.get(2).getPoint());
- // isCCW && (reqWinding == VectorUtil.CW);
- // skips inversion CW -> CCW ?
+ //FIXME: handle case when vertices come inverted - Rami
+ // skips inversion CW -> CCW
final boolean invert = hasWinding != reqWinding &&
reqWinding == VectorUtil.Winding.CW;
- if( hasWinding != reqWinding ) {
- System.err.println("Winding: i "+invert+" "+hasWinding+" -> "+reqWinding);
- }
final int max;
final int edgeType = reqWinding == VectorUtil.Winding.CCW ? HEdge.BOUNDARY : HEdge.HOLE ;
@@ -201,7 +198,8 @@ public class Loop {
for(int i=0; i< initVertices.size()-1; i++){
GraphVertex v = initVertices.get(i);
GraphVertex nextV = initVertices.get(i+1);
- for(GraphVertex cand:vertices){
+ for(int pos=0; pos<vertices.size(); pos++) {
+ GraphVertex cand = vertices.get(pos);
float distance = VectorUtil.computeLength(v.getCoord(), cand.getCoord());
if(distance < minDistance){
for (GraphVertex vert:vertices){
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
index b47612f51..ed51cce98 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
@@ -80,6 +80,7 @@ public class GlyphShape {
private void addOutlineVerticesFromGlyphVector(float[] coords, int segmentType){
switch(segmentType) {
case PathIterator.SEG_MOVETO:
+ shape.closeLastOutline();
shape.addEmptyOutline();
addVertexToLastOutline(vertexFactory().create(coords, 0, 2, true));
numVertices++;