[OpenJDK 2D-Dev] Corner case drawing wide lines of zero length
jon.vanalten at redhat.com
jon.vanalten at redhat.com
Tue Jun 8 14:10:21 UTC 2010
<BUMP>
Hi, I sent this a while ago. Wondering if anyone has any feedback?
thanks in advance,
jon
----- "jon vanalten" <jon.vanalten at redhat.com> wrote:
> Hi,
>
> I am new to this list, hopefully it is okay that I post a potential
> fix to a very minor rendering bug.
>
> I've been looking at a bug reported downstream at IcedTea:
>
> http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=383
>
> To summarize, if a line is drawn via Graphics2D.drawLine() of zero
> length but thickness greater than 1, the endcap decorations are not
> rendered. This is because the sun.java2d.pisces.Stroker class ignores
> such line segments. This is ideal in most situations drawing complex
> shapes, but when such a line segment is the entire shape the end
> result nothing at all is rendered. The closed-source Sun JDK
> implementation does render endcap decorations in this case, and the
> documentation of the BasicStroke class related to this suggests that
> they should be rendered.
>
> I've put together a (possibly straw-man) fix. Please do pick it
> apart, I have never looked at the graphics implementation before
> trying to tackle this bug. I basically add a boolean to indicate that
> the finish() step should be taken if *any* lineTo() call has occurred,
> and in the finish() step detect if there are any segments and if no
> manually draw in the caps (while allowing normal behaviour in other
> cases).
>
> See webrev at:
>
> http://icedtea.classpath.org/~vanaltj/webrevs/2d/zeroline/webrev/
> (or download)
> http://icedtea.classpath.org/~vanaltj/webrevs/2d/zeroline/webrev.zip
>
> Your comments are appreciated.
>
> cheers,
>
> jon
More information about the 2d-dev
mailing list