Bug 697069

Summary: PDF display inconsistency (gradient)
Product: MuPDF Reporter: Tomasz Kuchta <t.kuchta>
Component: mupdfAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED WONTFIX    
Severity: normal CC: robin.watts
Priority: P4    
Version: 1.7   
Hardware: PC   
OS: All   
Customer: Word Size: ---
Attachments: test file

Description Tomasz Kuchta 2016-08-26 04:13:23 UTC
Created attachment 12890 [details]
test file

File 047838.pdf seems to be displayed inconsistently in MuPDF. The background has many while horizontal lines going across. That's not the case for Acrobat and Chromium.

The file comes from the Govdocs data set (http://digitalcorpora.org/corpora/govdocs)
It can be extracted from this archive: http://digitalcorpora.org/corp/files/govdocs1/zipfiles/047.zip
Comment 1 Robin Watts 2016-10-10 08:25:00 UTC
It's to do with the construction of the file, and the antialiasing method used by MuPDF.

The gradient is not rendered as a linear fill in PDF, but rather as a series of abutting lines.

These lines do not completely fill destination pixels, and so the background color blends through while anti-aliasing. This leads to the effect you see.

The only way around this is to disable anti-aliasing. This can be done at the command line with mutool draw, and as a compile option (-DAA_BITS=0) for the viewer.
Comment 2 Tomasz Kuchta 2016-10-10 08:42:48 UTC
Hi Robin, 
Thank you for checking that. 
If I understand correctly, the display difference is caused by the way the lies are drawn with anti-aliasing on - is that correct?
Is it the case that the rendering in Acrobat and Chromium is incorrect or we just can't say which one is correct as it is up to the PDF renderer to decide how to display that part?

Thank you,
Tomasz
Comment 3 Robin Watts 2016-10-10 12:34:10 UTC
(In reply to Tomasz Kuchta from comment #2)
> If I understand correctly, the display difference is caused by the way the
> lies are drawn with anti-aliasing on - is that correct?

Yes.

> Is it the case that the rendering in Acrobat and Chromium is incorrect or we
> just can't say which one is correct as it is up to the PDF renderer to
> decide how to display that part?

That's broadly correct.

When rendering without anti-aliasing, it's fairly clear what results are expected, and MuPDF/Acrobat/Chrome all pretty much agree.

When anti-aliasing is enabled the situation is fuzzier. There are approaches to AA that we could take (draw at a higher resolution and then scale down) where these results would not occur.

It is fairest to say that these results are due to a combination of the particular way that we choose to implement AA, with the construction of that PDF file.