aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/geom/plane
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-05-06 14:50:56 +0200
committerSven Gothel <[email protected]>2011-05-06 14:50:56 +0200
commit2570c1bee6dd8b33ac2e92b533e32b69b02a2cfc (patch)
tree2c8773508e01a628e3f9da121e78d45d8636705c /src/jogl/classes/jogamp/graph/geom/plane
parentd75835796900cac602f7e5789601ffba0a27efe2 (diff)
GlyphShape: Use switch block for PathIterator - adding default (exception)
Implements more of John Pritchard <[email protected]> proposal https://github.com/syntelos/jogl/commit/05a7ec92d30e1e688b1eb7cc317cad83a0e8fd60
Diffstat (limited to 'src/jogl/classes/jogamp/graph/geom/plane')
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/Path2D.java51
1 files changed, 27 insertions, 24 deletions
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;