[OpenJDK 2D-Dev] Fix for bug where long dashed lines can make graphics go black.
dlila at redhat.com
Wed Jun 9 22:49:35 UTC 2010
I think I have a fix for this bug:
The bug was caused by a few integer overflows in sun/java2d/pisces/Dasher.java
and sun/java2d/pisces/Stroker.java which would cause the whole container to
fill up with whatever colour the line had. Dasher.java was prone to 2 overflows:
one when computing the x and y coordinate lengths of the line at hand, and
another which actually happened in PiscesMath.hypot(int,int). I fixed these
two by turning the variables into longs and using PiscesMath.hypot(long,long).
Stroker.java was only prone to overflows when drawing end caps or when adding
offsets to points. I fixed these by making sure lineTo and moveTo never moved
too close to the boundaries set by Integer.MAX_VALUE and Integer.MIN_VALUE.
I welcome any feedback.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7068 bytes
Desc: not available
More information about the 2d-dev