diff options
author | Sven Gothel <[email protected]> | 2023-04-18 05:15:16 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-18 05:15:16 +0200 |
commit | c65c750e032118f229050ff8e834961264ed0591 (patch) | |
tree | 8500286ca6086eb21a9b275ccd586185090b1500 /src/jogl/classes/jogamp/graph/font | |
parent | cd845589eea6c7773007e013bd5f2f37242cbe1a (diff) |
Graph + GraphUI: Consolidate Vertex: Drop SVertex and factory, use Vec[234]f instead of float[] and remove unused VectorUtil methods
After Matrix4f consolidation and proving same or better performance on non array types,
this enhances code readability, simplifies API, reduces bugs and may improve performance.
GraphUI:
- Have RoundButton as a functional class to make a round or rectangular backdrop,
i.e. impl. addShapeToRegion() via reused addRoundShapeToRegion()
Diffstat (limited to 'src/jogl/classes/jogamp/graph/font')
-rw-r--r-- | src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java | 6 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java | 9 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index 8a9ad8bab..f7c10c335 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -213,7 +213,7 @@ class TypecastFont implements Font { glyph_advance = glyph.getAdvanceWidth(); glyph_leftsidebearings = glyph.getLeftSideBearing(); final AABBox sb = glyph.getBBox(); - final OutlineShape s = TypecastRenderer.buildShape(metrics.getUnitsPerEM(), glyph, OutlineShape.getDefaultVertexFactory()); + final OutlineShape s = TypecastRenderer.buildShape(metrics.getUnitsPerEM(), glyph); if( 0 < s.getOutlineVectexCount() ) { glyph_bbox = sb; shape = s; @@ -221,7 +221,7 @@ class TypecastFont implements Font { } else { // non-contour glyph -> whitespace glyph_bbox = new AABBox(0f,0f,0f, glyph_advance, glyph_height, 0f); - shape = TypecastRenderer.buildEmptyShape(metrics.getUnitsPerEM(), glyph_bbox, OutlineShape.getDefaultVertexFactory()); + shape = TypecastRenderer.buildEmptyShape(metrics.getUnitsPerEM(), glyph_bbox); isWhiteSpace = true; } } else { @@ -229,7 +229,7 @@ class TypecastFont implements Font { glyph_advance = getAdvanceWidthFU(glyph_id); glyph_leftsidebearings = 0; glyph_bbox = new AABBox(0f,0f,0f, glyph_advance, glyph_height, 0f); - shape = TypecastRenderer.buildEmptyShape(metrics.getUnitsPerEM(), glyph_bbox, OutlineShape.getDefaultVertexFactory()); + shape = TypecastRenderer.buildEmptyShape(metrics.getUnitsPerEM(), glyph_bbox); isWhiteSpace = true; } KernSubtable kernSub = null; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java index 7b0e1b5c9..3aa9a1c12 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java @@ -34,7 +34,6 @@ import jogamp.opengl.Debug; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.math.geom.AABBox; /** @@ -137,8 +136,8 @@ public class TypecastRenderer { shape.addVertex(0, p3.x/unitsPerEM, p3.y/unitsPerEM, true); } - public static OutlineShape buildEmptyShape(final int unitsPerEM, final AABBox box, final Factory<? extends Vertex> vertexFactory) { - final OutlineShape shape = new OutlineShape(vertexFactory); + public static OutlineShape buildEmptyShape(final int unitsPerEM, final AABBox box) { + final OutlineShape shape = new OutlineShape(); if( PRINT_CODE ) { System.err.printf("%n// Start Empty Shape%n"); } final float x1 = box.getMinX() / unitsPerEM; final float x2 = box.getMaxX() / unitsPerEM; @@ -169,11 +168,11 @@ public class TypecastRenderer { return shape; } - public static OutlineShape buildShape(final int unitsPerEM, final Glyph glyph, final Factory<? extends Vertex> vertexFactory) { + public static OutlineShape buildShape(final int unitsPerEM, final Glyph glyph) { if (glyph == null) { return null; } - final OutlineShape shape = new OutlineShape(vertexFactory); + final OutlineShape shape = new OutlineShape(); if (glyph instanceof T2Glyph) { // Type 1/2: Cubic if( PRINT_CODE ) { System.err.printf("%n// Start Type-2 Shape for Glyph %d%n", glyph.getID()); } |