[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:       dlila () redhat ! com (Denis Lila)
Date:       2010-06-16 20:38:53
Message-ID: 617581156.298981276720733177.JavaMail.root () zmail04 ! collab ! prod ! int ! phx2 ! redhat ! com
[Download RAW message or body]

Oops, I forgot to attach the patch.

----- Original Message -----
From: "Denis Lila" <dlila at redhat.com>
To: "Jon VanAlten" <jon.vanalten at redhat.com>
Cc: 2d-dev at openjdk.java.net
Sent: Wednesday, June 16, 2010 4:28:27 PM GMT -05:00 US/Canada Eastern
Subject: Re: [OpenJDK 2D-Dev] Corner case drawing wide lines of zero length

So, I've been looking at this a bit more, and I noticed that there
was a problem when a non-diagonal affine transformation was in effect.
This was because scaledLineWidth2 was being used to draw the end caps,
but this variable is valid only when the linear transformation
in effect is of the form [[n, 0], [0, n]].

I also simplified, somewhat, the drawing of round end caps.

Denis.

----- Original Message -----
From: "Denis Lila" <dlila at redhat.com>
To: "Jon VanAlten" <jon.vanalten at redhat.com>
Cc: 2d-dev at openjdk.java.net
Sent: Monday, June 14, 2010 5:04:46 PM GMT -05:00 US/Canada Eastern
Subject: Re: [OpenJDK 2D-Dev] Corner case drawing wide lines of zero length

I can see one slight problem with this.
moveTo will check whether "if (prev == LINE_TO) {" in line 488.
This should be changed to "if (prev == LINE_TO || atLeastOneLine) {".
If this is not done, and if there are many moveTo's, each followed by
a lineTo to a line of 0 length, no end caps will be drawn for any of
the lines except perhaps the last lineTo.

See bug 197: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=197
for reproducers, effects, and some more discussion on this.

Regards,
Denis Lila.

----- Original Message -----
From: "jon vanalten" <jon.vanalten at redhat.com>
To: 2d-dev at openjdk.java.net
Sent: Tuesday, June 8, 2010 10:10:21 AM GMT -05:00 US/Canada Eastern
Subject: Re: [OpenJDK 2D-Dev] Corner case drawing wide lines of zero length

<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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0lenLineNoEndcaps.patch
Type: text/x-patch
Size: 4903 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20100616/9befffd4/attachment.bin 

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

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