From c3621221b9a563495b4f54fe60e18e8db8cc57fb Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 24 Feb 2014 13:32:34 +0100 Subject: Bug 802: Graph TextRenderer Performance Part-1 (incomplete, rendering artifacts) Strategy Change: - Font.Glyph itself holds it's OutlineShape with it's default scaling. Triangulation is done only once per glyph! - A CharSequence produces a Region by translating and scaling each Glyphs's OutlineShape. This removes the need for re-triangulate - see above. See: TextRendererUtil - The indices of re-added Triangles are offset to the new vertices (FIXME, seems not be be accurate yet). - OutlineShape's vertices and triangles are reused if 'clean'. - Simplified code - Reduced copies API Changes: - OutlineShape, Region, ...: See above - Removed TextRenderer, GlyphShape and GlyphString: Redundant - Added TextRendererUtil to produce the Region from CharSequence Result: - Over 600 fps while changing text for each frame. Previously only ~60fps max. TODO: - Region shall not hold the triangles itself, but the indices instead. This will remove the need to swizzle w/ vertices in the Region Renderer impl and easies reusage of OutlineShapes. --- src/jogl/classes/com/jogamp/graph/font/Font.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/jogl/classes/com/jogamp/graph/font') diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java index 6c0041de9..1e0572037 100644 --- a/src/jogl/classes/com/jogamp/graph/font/Font.java +++ b/src/jogl/classes/com/jogamp/graph/font/Font.java @@ -91,6 +91,7 @@ public interface Font { public float getScale(float pixelSize); public AABBox getBBox(float pixelSize); public float getAdvance(float pixelSize, boolean useFrationalMetrics); + public OutlineShape getShape(); public int hashCode(); } @@ -117,13 +118,7 @@ public interface Font { public boolean isPrintableChar( char c ); /** - * @param glyph source of the created OutlineShape - * @param vertexFactory factory for vertices - * @return OutlineShape of the glyph - */ - public OutlineShape getOutlineShape(Glyph glyph, Factory vertexFactory); - - /** + * @deprecated Remove altogether - use {@link #getOutlineShape(Glyph, Factory) * @param shapes optional storage of OutlineShapes passed by user, new shapes are appended * @param string source of the created OutlineShapes * @param pixelSize -- cgit v1.2.3