aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-02-15 04:17:41 +0100
committerSven Gothel <[email protected]>2023-02-15 04:17:41 +0100
commit91f5d1019c59f56654f40ce18d70d15117b7f302 (patch)
treeffb2716314cd24e546912a79e1ebd3dde8a77a1e /src/test
parent250832f581d8acccf0b62259e2ec08adb259be0e (diff)
Graph TextRegionUtil: Move ShapeVisitor to OutlineShape.Visitor and processString(..) to Font, cleaning up ..
Further having Font.processString() return the AABBox of the whole string's 'laidout' OutlineShapes, which is used for (debug) Font.getPointsBounds2(..) just to validate the coordinated with the Glyph based AABBox of Font.getPointsBounds(..). Static TextRegionUtil.drawString(..) no more require to pass the temp AffineTransform instances (ugly).
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java5
4 files changed, 9 insertions, 16 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
index 6bc120cde..f307a1196 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
@@ -272,11 +272,9 @@ public abstract class TextRendererGLELBase implements GLEventListener {
if( cacheRegion ) {
textRenderUtil.drawString3D(gl, renderer, font, text, null, vbaaSampleCount);
} else if( null != region ) {
- TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, vbaaSampleCount,
- textRenderUtil.tempT1, textRenderUtil.tempT2);
+ TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, vbaaSampleCount);
} else {
- TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, vbaaSampleCount,
- textRenderUtil.tempT1, textRenderUtil.tempT2);
+ TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, vbaaSampleCount);
}
renderer.enable(gl, false);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
index abf7151d0..e49d2a9e4 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
@@ -327,8 +327,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
pmv.glScalef(sxy, sxy, 1.0f);
}
// No cache, keep region alive!
- TextRegionUtil.drawString3D(gl, regionFPS, renderer, font, text, null, sampleCountFPS, textRegionUtil.tempT1,
- textRegionUtil.tempT2);
+ TextRegionUtil.drawString3D(gl, regionFPS, renderer, font, text, null, sampleCountFPS);
}
float dx = width - ( fontNameBox.getWidth() - font.getAdvanceWidth(Glyph.ID_SPACE) ) * pixelSizeFName;
@@ -379,15 +378,13 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
}
if(!userInput) {
if( bottomTextUseFrustum ) {
- TextRegionUtil.drawString3D(gl, regionBottom, renderer, font, text2, null, getSampleCount(), textRegionUtil.tempT1,
- textRegionUtil.tempT2);
+ TextRegionUtil.drawString3D(gl, regionBottom, renderer, font, text2, null, getSampleCount());
} else {
textRegionUtil.drawString3D(gl, renderer, font, text2, null, getSampleCount());
}
} else {
if( bottomTextUseFrustum ) {
- TextRegionUtil.drawString3D(gl, regionBottom, renderer, font, userString.toString(), null, getSampleCount(), textRegionUtil.tempT1,
- textRegionUtil.tempT2);
+ TextRegionUtil.drawString3D(gl, regionBottom, renderer, font, userString.toString(), null, getSampleCount());
} else {
textRegionUtil.drawString3D(gl, renderer, font, userString.toString(), null, getSampleCount());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java
index eb86aba81..749ac7965 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java
@@ -30,7 +30,6 @@ package com.jogamp.opengl.test.junit.graph.demos.ui;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.opengl.RegionRenderer;
-import com.jogamp.graph.curve.opengl.TextRegionUtil;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.Vertex.Factory;
@@ -91,7 +90,7 @@ public class Label extends UIShape {
private final AffineTransform tempT1 = new AffineTransform();
private final AffineTransform tempT2 = new AffineTransform();
- private final TextRegionUtil.ShapeVisitor shapeVisitor = new TextRegionUtil.ShapeVisitor() {
+ private final OutlineShape.Visitor shapeVisitor = new OutlineShape.Visitor() {
@Override
public void visit(final OutlineShape shape, final AffineTransform t) {
shape.setSharpness(shapesSharpness);
@@ -104,7 +103,7 @@ public class Label extends UIShape {
protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) {
final AffineTransform t_sxy = new AffineTransform();
t_sxy.setToScale(pixelSize, pixelSize);
- TextRegionUtil.processString(shapeVisitor, t_sxy, font, text, tempT1, tempT2);
+ font.processString(shapeVisitor, t_sxy, text, tempT1, tempT2);
final float[] ctr = box.getCenter();
setRotationOrigin( ctr[0], ctr[1], ctr[2]);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java
index c43714b31..c30c75959 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java
@@ -29,7 +29,6 @@ package com.jogamp.opengl.test.junit.graph.demos.ui;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.curve.opengl.TextRegionUtil;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.geom.plane.AffineTransform;
import com.jogamp.opengl.math.geom.AABBox;
@@ -74,7 +73,7 @@ public class Label0 {
private final AffineTransform tempT1 = new AffineTransform();
private final AffineTransform tempT2 = new AffineTransform();
- private final TextRegionUtil.ShapeVisitor shapeVisitor = new TextRegionUtil.ShapeVisitor() {
+ private final OutlineShape.Visitor shapeVisitor = new OutlineShape.Visitor() {
@Override
public void visit(final OutlineShape shape, final AffineTransform t) {
region.addOutlineShape(shape, t, rgbaColor);
@@ -90,7 +89,7 @@ public class Label0 {
final AffineTransform t_sxy = new AffineTransform(tLeft);
final AffineTransform tmp = new AffineTransform();
t_sxy.scale(pixelSize, pixelSize, tmp);
- TextRegionUtil.processString(shapeVisitor, t_sxy, font, text, tempT1, tempT2);
+ font.processString(shapeVisitor, t_sxy, text, tempT1, tempT2);
this.region = null;
return box;
}