[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    [OpenJDK 2D-Dev] Corner case drawing wide lines of zero length
From:       jon.vanalten () redhat ! com (jon ! vanalten at redhat ! com)
Date:       2010-04-30 20:31:59
Message-ID: 1996248586.182881272659519931.JavaMail.root () zmail01 ! collab ! prod ! int ! phx2 ! redhat ! com
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic