Hi,
There is a bug in the pisces Stroker in finish(). When ldx and ldy are
so small (zero) that lineLength() will return zero, then you will get a
div by zero exception.
You can see this with for example this webstart application (you will
need to have IcedTeaWebstart [netx] installed):
http://linuxhippy.blogspot.com/2008/11/jgears2-rendermark.html
java.lang.ArithmeticException: / by zero
at sun.java2d.pisces.Stroker.finish(Stroker.java:698)
at sun.java2d.pisces.Stroker.close(Stroker.java:592)
at
sun.java2d.pisces.PiscesRenderingEngine.pathTo(PiscesRenderingEngine.java:248)
at
sun.java2d.pisces.PiscesRenderingEngine.strokeTo(PiscesRenderingEngine.java:231)
at
sun.java2d.pisces.PiscesRenderingEngine.strokeTo(PiscesRenderingEngine.java:181)
at
sun.java2d.pisces.PiscesRenderingEngine.strokeTo(PiscesRenderingEngine.java:145)
at sun.java2d.pipe.LoopPipe.getStrokeSpans(LoopPipe.java:274)
at sun.java2d.x11.X11Renderer.draw(X11Renderer.java:343)
at sun.java2d.pipe.ValidatePipe.draw(ValidatePipe.java:154)
at sun.java2d.SunGraphics2D.draw(SunGraphics2D.java:2392)
at JGears2.renderShape(JGears2.java:244)
[...]
Attached is the workaround that I checked into IcedTea to make this work
reliably:
2008-11-21 Mark Wielaard <[EMAIL PROTECTED]>
* patches/icedtea-stroker-finish.patch: New patch.
* Makefile.am (ICEDTEA_PATCHES): Add new patch.
* HACKING: Document new patch.
Cheers,
Mark
--- openjdk6/jdk/src/share/classes/sun/java2d/pisces/Stroker.java
+++ openjdk/jdk/src/share/classes/sun/java2d/pisces/Stroker.java
@@ -695,7 +695,7 @@
long ldx = (long)(px0 - x0);
long ldy = (long)(py0 - y0);
long llen = lineLength(ldx, ldy);
- long s = (long)lineWidth2*65536/llen;
+ long s = (llen == 0) ? 0 : (long)lineWidth2*65536/llen;
int capx = x0 - (int)(ldx*s >> 16);
int capy = y0 - (int)(ldy*s >> 16);
@@ -717,7 +717,7 @@
long ldx = (long)(sx1 - sx0);
long ldy = (long)(sy1 - sy0);
long llen = lineLength(ldx, ldy);
- long s = (long)lineWidth2*65536/llen;
+ long s = (llen == 0) ? 0 : (long)lineWidth2*65536/llen;
int capx = sx0 - (int)(ldx*s >> 16);
int capy = sy0 - (int)(ldy*s >> 16);