From dbff115343200e08cf2310a379011f9a9fcdd334 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 5 Feb 2023 12:12:42 +0100 Subject: Graph: Path2D: Remove redundant accessors, comment on append(..) --- .../classes/com/jogamp/graph/geom/plane/Path2D.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/jogl/classes/com/jogamp/graph/geom') 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; -- cgit v1.2.3