diff options
author | Sven Gothel <[email protected]> | 2023-04-19 20:47:12 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-19 20:47:12 +0200 |
commit | 93fede2562cab03478bbc1e0df1846a42103c563 (patch) | |
tree | df55f6f95b8ad5c1f9f2a630cca5b8c85f6688df /src/jogl/classes/com/jogamp/graph/curve/Region.java | |
parent | 7a2f6bfdfadcaba1d6fecc2389ba7b91e927104a (diff) |
Graph: Region.countOutlineShape(..) -> static, allow usage w/o instance; TextRegionUtil.addStringToRegion() grow region buffer w/ counting (as well); GLRegion.create(..) count + reuse create(.., size) static-ctor
All supported string -> region method utilize pre-calc of size and growth!
Before, GraphUI's Label0 used TextRegionUtil.addStringToRegion() and hence missed this optimization path.
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve/Region.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/Region.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java index 799b8b7bd..e897acba1 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/Region.java +++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java @@ -477,14 +477,20 @@ public abstract class Region { /** * Count required number of vertices and indices adding to given int[2] `vertIndexCount` array. * <p> - * The region's buffer can be either set using {@link Region#setBufferCapacity(int, int)} or grown using {@link Region#growBuffer(int, int)}. + * The region's buffer can be either set using {@link Region#setBufferCapacity(int, int)}, + * {@link GLRegion#create(GLProfile, int, TextureSequence, int, int) GLRegion ctor w/ initial capacities} + * or grown using {@link Region#growBuffer(int, int)}. + * </p> + * <p> + * Method is utilized in {@link GLRegion#create(GLProfile, int, TextureSequence, com.jogamp.graph.font.Font, CharSequence) GLRegion ctor w/ font + text}, + * computing the initial capacity. * </p> * @param shape the {@link OutlineShape} to count * @param vertIndexCount the int[2] storage where the counted vertices and indices are added, vertices at [0] and indices at [1] * @see #setBufferCapacity(int, int) * @see #growBuffer(int, int) */ - public final void countOutlineShape(final OutlineShape shape, final int[/*2*/] vertIndexCount) { + public static final void countOutlineShape(final OutlineShape shape, final int[/*2*/] vertIndexCount) { final List<Triangle> trisIn = shape.getTriangles(OutlineShape.VerticesState.QUADRATIC_NURBS); final ArrayList<Vertex> vertsIn = shape.getVertices(); { @@ -498,14 +504,16 @@ public abstract class Region { /** * Count required number of vertices and indices adding to given int[2] `vertIndexCount` array. * <p> - * The region's buffer can be either set using {@link Region#setBufferCapacity(int, int)} or grown using {@link Region#growBuffer(int, int)}. + * The region's buffer can be either set using {@link Region#setBufferCapacity(int, int)}, + * {@link GLRegion#create(GLProfile, int, TextureSequence, int, int) GLRegion ctor w/ initial capacities} + * or grown using {@link Region#growBuffer(int, int)}. * </p> * @param shapes list of {@link OutlineShape} to count * @param vertIndexCount the int[2] storage where the counted vertices and indices are added, vertices at [0] and indices at [1] * @see #setBufferCapacity(int, int) * @see #growBuffer(int, int) */ - public final void countOutlineShapes(final List<OutlineShape> shapes, final int[/*2*/] vertIndexCount) { + public static final void countOutlineShapes(final List<OutlineShape> shapes, final int[/*2*/] vertIndexCount) { for (int i = 0; i < shapes.size(); i++) { countOutlineShape(shapes.get(i), vertIndexCount); } |