aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/geom/plane
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-02-24 13:32:34 +0100
committerSven Gothel <[email protected]>2014-02-24 13:32:34 +0100
commitc3621221b9a563495b4f54fe60e18e8db8cc57fb (patch)
tree00aded20f3582e517372c12f58e19d3524582099 /src/jogl/classes/jogamp/graph/geom/plane
parentf69df875d0b9f969a816d143ed589b25e50cd9e7 (diff)
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.
Diffstat (limited to 'src/jogl/classes/jogamp/graph/geom/plane')
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java32
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/Path2D.java2
2 files changed, 15 insertions, 19 deletions
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
index 32e2b6a39..f5cf8dd95 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
@@ -121,6 +121,8 @@ public class AffineTransform implements Cloneable, Serializable {
}
}
+ public final Vertex.Factory<? extends Vertex> getFactory() { return pointFactory; }
+
/*
* Method returns type of affine transformation.
*
@@ -403,12 +405,10 @@ public class AffineTransform implements Cloneable, Serializable {
public Vertex transform(Vertex src, Vertex dst) {
if (dst == null) {
- dst = pointFactory.create();
+ dst = pointFactory.create(src.getId(), src.isOnCurve(), src.getTexCoord());
}
-
- float x = src.getX();
- float y = src.getY();
-
+ final float x = src.getX();
+ final float y = src.getY();
dst.setCoord(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12, 0f);
return dst;
}
@@ -416,12 +416,12 @@ public class AffineTransform implements Cloneable, Serializable {
public void transform(Vertex[] src, int srcOff, Vertex[] dst, int dstOff, int length) {
while (--length >= 0) {
Vertex srcPoint = src[srcOff++];
- float x = srcPoint.getX();
- float y = srcPoint.getY();
Vertex dstPoint = dst[dstOff];
if (dstPoint == null) {
throw new IllegalArgumentException("dst["+dstOff+"] is null");
}
+ final float x = srcPoint.getX();
+ final float y = srcPoint.getY();
dstPoint.setCoord(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12, 0f);
dst[dstOff++] = dstPoint;
}
@@ -446,12 +446,10 @@ public class AffineTransform implements Cloneable, Serializable {
public Vertex deltaTransform(Vertex src, Vertex dst) {
if (dst == null) {
- dst = pointFactory.create();
+ dst = pointFactory.create(src.getId(), src.isOnCurve(), src.getTexCoord());
}
-
- float x = src.getX();
- float y = src.getY();
-
+ final float x = src.getX();
+ final float y = src.getY();
dst.setCoord(x * m00 + y * m01, x * m10 + y * m11, 0f);
return dst;
}
@@ -471,12 +469,10 @@ public class AffineTransform implements Cloneable, Serializable {
throw new NoninvertibleTransformException(determinantIsZero);
}
if (dst == null) {
- dst = pointFactory.create();
+ dst = pointFactory.create(src.getId(), src.isOnCurve(), src.getTexCoord());
}
-
- float x = src.getX() - m02;
- float y = src.getY() - m12;
-
+ final float x = src.getX() - m02;
+ final float y = src.getY() - m12;
dst.setCoord((x * m11 - y * m01) / det, (y * m00 - x * m10) / det, 0f);
return dst;
}
@@ -502,7 +498,7 @@ public class AffineTransform implements Cloneable, Serializable {
return null;
}
if (src instanceof Path2D) {
- return ((Path2D)src).createTransformedShape(this);
+ return src.createTransformedShape(this);
}
PathIterator path = src.iterator(this);
Path2D dst = new Path2D(path.getWindingRule());
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
index 33b80d6b8..a87c0a0a1 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
@@ -21,8 +21,8 @@ package jogamp.graph.geom.plane;
import java.util.NoSuchElementException;
+import com.jogamp.graph.geom.SVertex;
import com.jogamp.graph.geom.Vertex;
-import com.jogamp.graph.geom.opengl.SVertex;
import com.jogamp.opengl.math.geom.AABBox;