Created attachment 8360 [details] Lilypond output The bug was originally filed against Lilypond: http://code.google.com/p/lilypond/issues/detail?id=2328 Lilypond wants to draw a line with rounded ends. If rendering to PNG format, a write triangular area appears inside the line. I found by bisecting ghostscript repository that the issue was introduced in commit 43b14b24fcc13d816dd41ca335d52cd3074bd0d8, between 8.71 and 9.01. Reverting the patch fixes rendering. Rendering to the pnggray device doesn't make the white triange, so ghostscript is inconsistent between devices.
Created attachment 8361 [details] Rendering to pngalpha - with white triangle Rendered by gs -r300 -dBATCH -dNOPAUSE -sDEVICE=pngalpha -sOutputFile=box-alpha.png box.ps
Created attachment 8362 [details] Rendering to pnggray - without white triangle Rendered by gs -r300 -dBATCH -dNOPAUSE -sDEVICE=pnggray -sOutputFile=box-gray.png box.ps
Created attachment 8363 [details] Patch to fix the white triangle This is essentially a revert of commit commit cbcc4ac3c4d74ef2ca915c13c6d35a8a930ae4ff Author: Robin Watts <robin.watts@artifex.com> Date: Wed Apr 7 13:13:57 2010 +0000 Fix for bug 691228, problems with wide strokes with round caps/joins with antialiasing enabled. 2 small problems in the same code. In the antialiased case, we stroke by forming 2 paths (one up either side of the line) and then reverse one and concatenate it. This should happen whenever we meet a closepath, but due to a misplaced return, was being missed out in some round join cases. Also, when using a round join in the case where 2 lines meet 'in-line' we would inadvertently leave the point on the wrong side of the line. No changes in localcluster testing as this only affects antialiased results and that's not tested currently. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@11031 a1074d23-0009-0410-80fe-cf8c14f379e6
(In reply to comment #3) > Created attachment 8363 [details] > Patch to fix the white triangle > > This is essentially a revert of commit Simple reversion is clearly not the right fix, as that reintroduces all the problems that caused bug 691228 in the first place. I have implemented a fix that makes the fix dependent on the relative direction of the vectors, and this seems to fix both cases. commit 6961e71d7b6b9162f6b75fae60469175a4c8d43e Author: Robin Watts <robin.watts@artifex.com> Date: Thu Mar 7 00:45:41 2013 +0000 Bug 692862: Fix stroking problem with antialiasing The fix for bug 691228 causes problems in some cases; when joining two segment that are directly in line with the next, we add a circular line cap to ensure correct rendering. Which side of this end cap we end up on depends on which direction the line then continues in. Thanks for the report!