diff options
author | Sven Gothel <[email protected]> | 2014-03-05 03:23:44 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-03-05 03:23:44 +0100 |
commit | 79156e080ef919857f1624543e37b62794fb5a64 (patch) | |
tree | 8c7b3eeea7bb85b5af05356c7adce1f69606be3a /src/jogl/classes/jogamp/graph/font | |
parent | fe3daea00da48c90a4e0c90cf37514a3ab7093d6 (diff) |
Bug 801: VectorUtil: Pass result vector, allowing caller to manage memory (performance, reduce temp objects)
Diffstat (limited to 'src/jogl/classes/jogamp/graph/font')
3 files changed, 6 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index ae9c43ec5..3cd9ab7c1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -53,6 +53,7 @@ class TypecastFont implements Font { private final int cmapentries; private final IntObjectHashMap char2Glyph; private final TypecastHMetrics metrics; + private final float[] tmpV3 = new float[3]; // FIXME: Add cache size to limit memory usage ?? public TypecastFont(final OTFontCollection fontset) { @@ -260,7 +261,7 @@ class TypecastFont implements Font { final char character = string.charAt(i); if (character != ' ') { final Glyph glyph = getGlyph(character); - AABBox bbox = glyph.getBBox(pixelSize); + AABBox bbox = glyph.getBBox(pixelSize, tmpV3); height = (int)Math.ceil(Math.max(bbox.getHeight(), height)); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java index 82971848e..b0e283278 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java @@ -188,10 +188,10 @@ public class TypecastGlyph implements Font.Glyph { } @Override - public final AABBox getBBox(float pixelSize) { + public final AABBox getBBox(float pixelSize, float[] tmpV3) { final float size = getScale(pixelSize); AABBox newBox = getBBox().clone(); - newBox.scale(size); + newBox.scale(size, tmpV3); return newBox; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java index 7efad5fb0..4064e6463 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java @@ -82,9 +82,9 @@ class TypecastHMetrics implements Metrics { return pixelSize * unitsPerEM_Inv; } @Override - public final AABBox getBBox(float pixelSize) { + public final AABBox getBBox(float pixelSize, float[] tmpV3) { AABBox res = new AABBox(bbox.getLow(), bbox.getHigh()); - res.scale(getScale(pixelSize)); + res.scale(getScale(pixelSize), tmpV3); return res; } }
\ No newline at end of file |