diff options
author | Sven Gothel <[email protected]> | 2023-02-05 12:12:42 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-02-05 12:12:42 +0100 |
commit | dbff115343200e08cf2310a379011f9a9fcdd334 (patch) | |
tree | 6ab3be4f1bdce2a84b5c9297d87df9a8eb65bd29 /src/jogl/classes/com/jogamp/graph/geom | |
parent | bba021b2ce3b09251dd5635f418d5db5e141a304 (diff) |
Graph: Path2D: Remove redundant accessors, comment on append(..)
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/geom')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/geom/plane/Path2D.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/com/jogamp/graph/geom/plane/Path2D.java index d3a75c38c..8dbc5fd21 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/plane/Path2D.java +++ b/src/jogl/classes/com/jogamp/graph/geom/plane/Path2D.java @@ -164,8 +164,6 @@ public final class Path2D implements Cloneable { } - public float[] points() { return m_points; } - public int getType(final int idx) { return m_types[idx]; } public static int getPointCount(final int type) { return pointShift[type]; } public Path2D() { @@ -284,6 +282,11 @@ public final class Path2D implements Cloneable { append(p, connect); } + /** + * Append the given path geometry to this instance + * @param path the {@link PathIterator} to append to this {@link Path2D} + * @param connect pass true to turn an initial moveTo segment into a lineTo segment to connect the new geometry to the existing path, otherwise pass false. + */ public void append(final PathIterator path, boolean connect) { final float[] points = path.points(); while ( !path.isDone() ) { @@ -291,17 +294,18 @@ public final class Path2D implements Cloneable { final int type = path.getType(index); switch ( type ) { case PathIterator.SEG_MOVETO: - if (!connect || m_typeSize == 0) { + if ( !connect || 0 == m_typeSize ) { moveTo(points[index+0], points[index+1]); break; } - if (m_types[m_typeSize - 1] != PathIterator.SEG_CLOSE && - m_points[m_pointSize - 2] == points[index+0] && - m_points[m_pointSize - 1] == points[index+1]) + if ( m_types[m_typeSize - 1] != PathIterator.SEG_CLOSE && + m_points[m_pointSize - 2] == points[index+0] && + m_points[m_pointSize - 1] == points[index+1] + ) { break; } - // NO BREAK; + // fallthrough: MOVETO -> LINETO case PathIterator.SEG_LINETO: lineTo(points[index+0], points[index+1]); break; |