aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java52
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/Path2D.java51
-rw-r--r--src/jogl/classes/jogamp/graph/math/plane/Crossing.java102
3 files changed, 109 insertions, 96 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
index 46d7fa947..749292297 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
@@ -77,30 +77,34 @@ public class GlyphShape {
}
private void addOutlineVerticesFromGlyphVector(float[] coords, int segmentType){
- if(segmentType == PathIterator.SEG_MOVETO){
- if(!shape.getLastOutline().isEmpty()){
- shape.addEmptyOutline();
- }
- addVertexToLastOutline(vertexFactory().create(coords, 0, 2, true));
- numVertices++;
- }
- else if(segmentType == PathIterator.SEG_LINETO){
- addVertexToLastOutline(vertexFactory().create(coords, 0, 2, true));
- numVertices++;
- }
- else if(segmentType == PathIterator.SEG_QUADTO){
- addVertexToLastOutline(vertexFactory().create(coords, 0, 2, false));
- addVertexToLastOutline(vertexFactory().create(coords, 2, 2, true));
- numVertices+=2;
- }
- else if(segmentType == PathIterator.SEG_CUBICTO){
- addVertexToLastOutline(vertexFactory().create(coords, 0, 2, false));
- addVertexToLastOutline(vertexFactory().create(coords, 2, 2, false));
- addVertexToLastOutline(vertexFactory().create(coords, 4, 2, true));
- numVertices+=3;
- }
- else if(segmentType == PathIterator.SEG_CLOSE){
- shape.closeLastOutline();
+ switch(segmentType) {
+ case PathIterator.SEG_MOVETO:
+ if(!shape.getLastOutline().isEmpty()){
+ shape.addEmptyOutline();
+ }
+ addVertexToLastOutline(vertexFactory().create(coords, 0, 2, true));
+ numVertices++;
+ break;
+ case PathIterator.SEG_LINETO:
+ addVertexToLastOutline(vertexFactory().create(coords, 0, 2, true));
+ numVertices++;
+ break;
+ case PathIterator.SEG_QUADTO:
+ addVertexToLastOutline(vertexFactory().create(coords, 0, 2, false));
+ addVertexToLastOutline(vertexFactory().create(coords, 2, 2, true));
+ numVertices+=2;
+ break;
+ case PathIterator.SEG_CUBICTO:
+ addVertexToLastOutline(vertexFactory().create(coords, 0, 2, false));
+ addVertexToLastOutline(vertexFactory().create(coords, 2, 2, false));
+ addVertexToLastOutline(vertexFactory().create(coords, 4, 2, true));
+ numVertices+=3;
+ break;
+ case PathIterator.SEG_CLOSE:
+ shape.closeLastOutline();
+ break;
+ default:
+ throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType);
}
}
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
index da64fe4e4..8082fe4e1 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
@@ -268,32 +268,35 @@ public final class Path2D implements Cloneable {
public void append(PathIterator path, boolean connect) {
while (!path.isDone()) {
- float coords[] = new float[6];
- switch (path.currentSegment(coords)) {
- case PathIterator.SEG_MOVETO:
- if (!connect || typeSize == 0) {
- moveTo(coords[0], coords[1]);
+ final float coords[] = new float[6];
+ final int segmentType = path.currentSegment(coords);
+ switch (segmentType) {
+ case PathIterator.SEG_MOVETO:
+ if (!connect || typeSize == 0) {
+ moveTo(coords[0], coords[1]);
+ break;
+ }
+ if (types[typeSize - 1] != PathIterator.SEG_CLOSE &&
+ points[pointSize - 2] == coords[0] &&
+ points[pointSize - 1] == coords[1])
+ {
+ break;
+ }
+ // NO BREAK;
+ case PathIterator.SEG_LINETO:
+ lineTo(coords[0], coords[1]);
break;
- }
- if (types[typeSize - 1] != PathIterator.SEG_CLOSE &&
- points[pointSize - 2] == coords[0] &&
- points[pointSize - 1] == coords[1])
- {
+ case PathIterator.SEG_QUADTO:
+ quadTo(coords[0], coords[1], coords[2], coords[3]);
break;
- }
- // NO BREAK;
- case PathIterator.SEG_LINETO:
- lineTo(coords[0], coords[1]);
- break;
- case PathIterator.SEG_QUADTO:
- quadTo(coords[0], coords[1], coords[2], coords[3]);
- break;
- case PathIterator.SEG_CUBICTO:
- curveTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
- break;
- case PathIterator.SEG_CLOSE:
- closePath();
- break;
+ case PathIterator.SEG_CUBICTO:
+ curveTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
+ break;
+ case PathIterator.SEG_CLOSE:
+ closePath();
+ break;
+ default:
+ throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType);
}
path.next();
connect = false;
diff --git a/src/jogl/classes/jogamp/graph/math/plane/Crossing.java b/src/jogl/classes/jogamp/graph/math/plane/Crossing.java
index 2138b217d..9be5978cc 100644
--- a/src/jogl/classes/jogamp/graph/math/plane/Crossing.java
+++ b/src/jogl/classes/jogamp/graph/math/plane/Crossing.java
@@ -467,31 +467,34 @@ public class Crossing {
int cross = 0;
float mx, my, cx, cy;
mx = my = cx = cy = 0.0f;
- float coords[] = new float[6];
+ final float coords[] = new float[6];
while (!p.isDone()) {
- switch (p.currentSegment(coords)) {
- case PathIterator.SEG_MOVETO:
- if (cx != mx || cy != my) {
- cross += crossLine(cx, cy, mx, my, x, y);
- }
- mx = cx = coords[0];
- my = cy = coords[1];
- break;
- case PathIterator.SEG_LINETO:
- cross += crossLine(cx, cy, cx = coords[0], cy = coords[1], x, y);
- break;
- case PathIterator.SEG_QUADTO:
- cross += crossQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3], x, y);
- break;
- case PathIterator.SEG_CUBICTO:
- cross += crossCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5], x, y);
- break;
- case PathIterator.SEG_CLOSE:
- if (cy != my || cx != mx) {
- cross += crossLine(cx, cy, cx = mx, cy = my, x, y);
- }
- break;
+ final int segmentType = p.currentSegment(coords);
+ switch (segmentType) {
+ case PathIterator.SEG_MOVETO:
+ if (cx != mx || cy != my) {
+ cross += crossLine(cx, cy, mx, my, x, y);
+ }
+ mx = cx = coords[0];
+ my = cy = coords[1];
+ break;
+ case PathIterator.SEG_LINETO:
+ cross += crossLine(cx, cy, cx = coords[0], cy = coords[1], x, y);
+ break;
+ case PathIterator.SEG_QUADTO:
+ cross += crossQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3], x, y);
+ break;
+ case PathIterator.SEG_CUBICTO:
+ cross += crossCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5], x, y);
+ break;
+ case PathIterator.SEG_CLOSE:
+ if (cy != my || cx != mx) {
+ cross += crossLine(cx, cy, cx = mx, cy = my, x, y);
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType);
}
// checks if the point (x,y) is the vertex of shape with PathIterator p
@@ -821,7 +824,7 @@ public class Crossing {
int count;
float mx, my, cx, cy;
mx = my = cx = cy = 0.0f;
- float coords[] = new float[6];
+ final float coords[] = new float[6];
float rx1 = x;
float ry1 = y;
@@ -830,30 +833,33 @@ public class Crossing {
while (!p.isDone()) {
count = 0;
- switch (p.currentSegment(coords)) {
- case PathIterator.SEG_MOVETO:
- if (cx != mx || cy != my) {
- count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
- }
- mx = cx = coords[0];
- my = cy = coords[1];
- break;
- case PathIterator.SEG_LINETO:
- count = intersectLine(cx, cy, cx = coords[0], cy = coords[1], rx1, ry1, rx2, ry2);
- break;
- case PathIterator.SEG_QUADTO:
- count = intersectQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3], rx1, ry1, rx2, ry2);
- break;
- case PathIterator.SEG_CUBICTO:
- count = intersectCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5], rx1, ry1, rx2, ry2);
- break;
- case PathIterator.SEG_CLOSE:
- if (cy != my || cx != mx) {
- count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
- }
- cx = mx;
- cy = my;
- break;
+ final int segmentType = p.currentSegment(coords);
+ switch (segmentType) {
+ case PathIterator.SEG_MOVETO:
+ if (cx != mx || cy != my) {
+ count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
+ }
+ mx = cx = coords[0];
+ my = cy = coords[1];
+ break;
+ case PathIterator.SEG_LINETO:
+ count = intersectLine(cx, cy, cx = coords[0], cy = coords[1], rx1, ry1, rx2, ry2);
+ break;
+ case PathIterator.SEG_QUADTO:
+ count = intersectQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3], rx1, ry1, rx2, ry2);
+ break;
+ case PathIterator.SEG_CUBICTO:
+ count = intersectCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5], rx1, ry1, rx2, ry2);
+ break;
+ case PathIterator.SEG_CLOSE:
+ if (cy != my || cx != mx) {
+ count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
+ }
+ cx = mx;
+ cy = my;
+ break;
+ default:
+ throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType);
}
if (count == CROSSING) {
return CROSSING;