diff options
author | Sven Gothel <[email protected]> | 2014-04-02 19:25:16 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-04-02 19:25:16 +0200 |
commit | abc833631e0ab30a06c7aff47a39a551544fd735 (patch) | |
tree | 1d6e5a94d2149d7b2635de5b5eccb330bc41cd2c /src/jogl/classes/com/jogamp/graph/geom/Outline.java | |
parent | e8a5a1cbb988670ca206ab1ac633e19a91bfa478 (diff) |
Bug 801: Reduce temp. object creation, i.e. GC load
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/geom/Outline.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/geom/Outline.java | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java index 80aea2af4..15a45b056 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java @@ -47,18 +47,35 @@ import com.jogamp.opengl.math.geom.AABBox; * * @see OutlineShape, Region */ -public class Outline implements Cloneable, Comparable<Outline> { +public class Outline implements Comparable<Outline> { - private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3); - private boolean closed = false; - private AABBox bbox = new AABBox(); - private boolean dirtyBBox = false; + private ArrayList<Vertex> vertices; + private boolean closed; + private final AABBox bbox; + private boolean dirtyBBox; /**Create an outline defined by control vertices. * An outline can contain off Curve vertices which define curved * regions in the outline. */ public Outline() { + vertices = new ArrayList<Vertex>(3); + closed = false; + bbox = new AABBox(); + dirtyBBox = false; + } + + /** + * Copy ctor + */ + public Outline(final Outline src) { + vertices = new ArrayList<Vertex>(src.vertices.size()); + for(int i=0; i<vertices.size(); i++) { + vertices.add( src.vertices.get(i).clone() ); + } + closed = src.closed; + bbox = new AABBox(src.bbox); + dirtyBBox = src.dirtyBBox; } public final int getVertexCount() { @@ -257,21 +274,4 @@ public class Outline implements Cloneable, Comparable<Outline> { } return true; } - - /** - * @return deep clone of this Outline - */ - @Override - public Outline clone() { - Outline o; - try { - o = (Outline) super.clone(); - } catch (CloneNotSupportedException e) { throw new InternalError(); } - o.bbox = bbox.clone(); - o.vertices = new ArrayList<Vertex>(vertices.size()); - for(int i=0; i<vertices.size(); i++) { - o.vertices.add(vertices.get(i).clone()); - } - return o; - } } |