Bug 688434 - Ghostscript+GSView incorrectly render ellipses
Summary: Ghostscript+GSView incorrectly render ellipses
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: MS Windows Display Driver (show other bugs)
Version: 8.60
Hardware: PC Windows 98
: P3 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-09 14:45 UTC by goldart.geo
Modified: 2008-12-19 08:31 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
e.zip (325.26 KB, application/octet-stream)
2006-02-14 04:22 UTC, leonardo
Details
patch (1.24 KB, patch)
2007-10-28 16:36 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description goldart.geo 2005-12-09 14:45:30 UTC
When viewing the file annots.pdf supplied with Ghostscript, the ellipses in page
2 show a small gap at the left side of the ellipse in GSView 4.7.  In some
ellipses, the top of the ellipse outline is clipped.  When viewing the same file
in Acrobat Reader 5.1, ellipses do not have gap, but clipped ellipse outline
remains.

Steps to Reproduce:
Just load annots.pdf supplied with Ghostscript into GSView, then set the zoom
level to 300 or above when viewing ellipses on page 2.
Comment 1 Stefan Kemper 2005-12-14 10:18:45 UTC
patch is good, please commit and close.

Thanks.
Comment 2 Stefan Kemper 2005-12-14 10:20:40 UTC
Ignore the last comment it is for bug 688433
Comment 3 Ray Johnston 2005-12-14 11:06:34 UTC
This looks like we are not aligning the ends of curves to the expected
angle (start and end of the eliipse should be horizontal). When we
flatten the curve the first and last segments are not vertical.

A small sequence which shows the problem is:

/m /moveto load def /c /curveto load def
5 5 scale 10 setlinewidth 10 10 translate
3 15.5038 m 3 23.2558 20.3488 28.0077 40.6976 28.0077 c
61.0464 28.0077 78.3952 23.2558 78.3952 15.5038 c
78.3952 7.7519 61.0464 3 40.6976 3 c
20.3488 3 3 7.7519 3 15.5038 c
stroke
showpage


Comment 4 leonardo 2006-02-14 04:22:56 UTC
Created attachment 2040 [details]
e.zip

For the supplied Postscript Adobe CPSI renders same as Ghostscropt - zee the
TIFF in the ZIP attached.
Comment 5 leonardo 2006-03-10 08:22:43 UTC
Patch to HEAD :
http://ghostscript.com/pipermail/gs-cvs/2006-March/006409.html
Comment 6 leonardo 2006-03-10 08:23:31 UTC
Please ignore copmment #5 - it was intended for another bug.
Comment 7 leonardo 2006-03-10 23:14:21 UTC
The PS interpreter appears compatible to CPSI.
The problem happens in the PDF interpreter only.
It must execute "true .setaccuratecurve
Comment 8 leonardo 2006-03-10 23:23:24 UTC
Passing to Ray, because don't know where toi insert "true .setaccuratecurves" 
into the PDF interpreter.
Comment 9 Ray Johnston 2006-03-12 22:18:17 UTC
The location for setting 'accuratecurves' is in pdf_main.ps:

--- lib/pdf_main.ps     (revision 6650)
+++ lib/pdf_main.ps     (working copy)
@@ -155,11 +155,13 @@

 /dopdfpages {   % firstpage# lastpage# dopdfpages -
   << /PDFScanRules true >> setuserparams       % set scanning rules for PDF vs. PS
+  true .setaccuratecurves                      % unlike PS, PDF seems to need this
   1 exch
     { dup /Page# exch store
       QUIET not { (Page ) print dup == flush } if
       pdfgetpage pdfshowpage
     } for
+  false .setaccuratecurves                     % unlike PS, PDF seems to need this
   << /PDFScanRules null >> setuserparams       % restore scanning rules for PS
 } bind def


After running a regression test, I'll commit this. Hopefully 'leo' will
have cleaned up the regression report so that I will be able to
update for any differences. Differences are expected (annots.pdf at the
very least).
Comment 10 Alex Cherepanov 2007-08-11 05:20:43 UTC
The patch for 'accuratecurves' has been committed as a rev. 6681 on 2006-3-23
but the bug report was not closed. Closing it now.
Comment 11 goldart.geo 2007-09-13 19:04:06 UTC
Are you sure it is fixed? I can still see the clipped eclipse in Ghostscript
8.60 under GSView.

Although the fixed code has been submitted to the source during 8.5x, as of
8.60, the gap on the left side of a ellipse is still visible in the annots.pdf
supplied with Ghostscript under high magnification (432 dpi), especially in
Ellipses Cyan, Magenta, Blue.

In addition, when resolution and zoom resolution are set to 746 and 300 dpi
respectively, The edge of Ellipse Magenta can be seen as a combination of
antialiased flat lines, rather than a smooth curve.  Strangely, the flat edge is
not visible when resolution is set to 895 dpi.

When increasing zoom ratio, the number of flat lines at the outer edge of
Ellipse Blue increases.

When annots.pdf is viewed in Acrobat Reader 5, there are no flat lines at the
edges of ellipses.

I am not sure if those two bugs are related, but I also noticed that the gap is
wider for flatter ellipses, and the gap is deeper for ellipses with wider lines.
 If they are related, then Ghostscript needs a different way to render ellipses.

In any case, both problems should be fixed at once.
Comment 12 Alex Cherepanov 2007-10-28 16:36:42 UTC
Created attachment 3506 [details]
patch

Move "true .setaccuratecurves" to the PDF graphic state initialization
where it belongs. This fix enables accurate curve rendering by GSview
doesn't use some parts of Ghostscript startup code.

Previous patch worked for a stand-along Ghostscript but didn't work
for GSview.

Regression testing shows no differences.
Comment 13 Alex Cherepanov 2007-10-28 16:37:38 UTC
The patch has been committed as a rev. 8331.