Bug 3387

Summary: line wrong rendered
Product: poppler Reporter: Pablo Rodríguez <freedesktop>
Component: generalAssignee: Kristian Høgsberg <krh>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: bas, suckfish
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 5904    
Bug Blocks:    
Attachments: poppler wrong rendered line
Fairly good testcase for this bug
patch that should fix the problem

Description Pablo Rodríguez 2005-05-24 02:24:28 UTC
In the attached image you have a comparision on how evince (with poppler 0.3.2 &
cairo 0.5.0) and gpdf render a line. I'm afraid that poppler is wrong. BTW, the
displayed document is located at
http://www.tug.org/pracjourn/2005-2/flynn/flynn.pdf.
Comment 1 Pablo Rodríguez 2005-05-24 02:26:15 UTC
Created attachment 2761 [details]
poppler wrong rendered line
Comment 2 Kristian Høgsberg 2005-05-26 06:30:23 UTC
Well, isn't that odd.  I don't why a solid lie would turn into a gradient line
like that, but will look into it.
Comment 3 Martin Kretzschmar 2005-06-06 08:11:21 UTC
The line is probably not a stroked path, but a scaled black pixmap. pdftk didn't
want to uncompress this file, so I'm not sure. But here's the relevant part of
xpdf -cmd output:

TJ [(X) 4.52619 (,) -271.951 (S) 3.05095 (G) 0.149484 (M) 2.47507 (L) -252.219
(a) -1.87468 (n) -0.17399 (d) -252.219 (t) 4.80065 (h) -0.17399 (e) -2.80099 (n)
-241.069 (X) 4.52619 (M) 2.47507 (L) 8.75095 (.) 9.09894]
Tf /R11 8.96638
  font: tag=R11 name='OGAAAA+Fp' 8.96638
Td 130.08 4.32
TJ [(2) -8.56716]
ET
Q
q
cm 718 0 0 -2 374.9 600.9
BI
Q
q
cm 4.16667 0 0 4.16667 0 0
BT
Tf /R11 7.57162
  font: tag=R11 name='OGAAAA+Fp' 7.57162
Tm 1 0 0 1 103.68 136.08
TJ [(1) -7.15724]
Tf /R11 9.96264
  font: tag=R11 name='OGAAAA+Fp' 9.96264
Td 4.08 -3.6
TJ [(A) 7.12011 (c) 10.3798 (t) -11.2598 (u) 0.749872 (a) -5.89017 (l) 1.92026
(l) 1.92026 (y) 122.386 (,) -279.98 (t) -11.2598 (h) 3.84052 (i) 1.92026 (s)
Comment 4 Kristian Høgsberg 2005-06-06 10:03:35 UTC
Yes that's it, the

  q
  cm 718 0 0 -2 374.9 600.9
  BI
  Q

part is an inline image (specifcally, an image mask).  Switching to
CAIRO_FILTER_NEAREST in CairoOutputDev::drawImageMask() fixes it, so we should
probably do that (for CairoOutputDev::drawImageMask() too).  Even better, we
should read the /Interpolate image dict entry to enable filtering when the
document requests it.
Comment 5 Robert McNees 2005-10-22 12:59:50 UTC
Are there any plans to address this bug? I know that it
seems like it's not a big deal, but it renders (no pun
intended) evince nearly unusable for people who regularly
read technical documents compiled from LaTeX. I know that
this does not occur for all LaTeX'ed documents, but it does
occur, for instance, with (as far as I can tell) all pdfs
downloaded from the e-print archive at www.arXiv.org. This
means that physicists, biologists, computer scientists, and
anyone else who uses the arXiv can't use evince in their
daily work, because of what appears to be a pretty simple bug.

I wish I could do it myself, but I haven't programmed in
years and have no idea where to begin. I'm not trying to
complain too much, just draw attention to a persistent bug
that was last commented on four months ago.

(In reply to comment #4)
> Yes that's it, the
> 
>   q
>   cm 718 0 0 -2 374.9 600.9
>   BI
>   Q
> 
> part is an inline image (specifcally, an image mask).  Switching to
> CAIRO_FILTER_NEAREST in CairoOutputDev::drawImageMask() fixes it, so we should
> probably do that (for CairoOutputDev::drawImageMask() too).  Even better, we
> should read the /Interpolate image dict entry to enable filtering when the
> document requests it.
Comment 6 Kristian Høgsberg 2005-12-04 13:40:40 UTC
*** Bug 4889 has been marked as a duplicate of this bug. ***
Comment 7 Cale Gibbard 2005-12-10 08:51:44 UTC
Created attachment 4061 [details]
Fairly good testcase for this bug

Here's a rather good testcase for the bug with lots of instances of it. Evince
also takes a very long time (minutes) at 100% cpu to render many of the pages,
which seems to indicate that it might be a good performance testcase as well.

In gv, xpdf, and acroread, the document looks fine and displays quickly. In
gpdf, many of the thinner lines are left out, but performance still isn't a
problem.

I would personally appreciate it if this bug was fixed soon, as it basically
makes evince all but unusable for perhaps about half of the documents I tend to
want to view. This problem also tends to occur very frequently in mathematical
formulas rendered by LaTeX, notably in the overbar for square roots and complex
conjugate, and the horizontal line used to denote a fraction. In some cases,
the formulas can become next to impossible to read.
Comment 8 Carl Worth 2005-12-10 09:22:06 UTC
This appears to be identical to an issue librsvg discovered when using cairo to
scale up images with either a width or height of one pixel.

There is likely a cairo bug here, (or it's possible it could be declared a
feature---I haven't looked closely enough) but if poppler would just set
CAIRO_FILTER_NEAREST in the case of images where one of the dimensions is 1 then
that might be good enough for working around the bug (and without making the
scaling of larger images look nasty).

In comment #4, Kristian mentioned the drawImageMask function in which that
workaround could go, (and it looks like he meant to suggest another function,
but instead listed the same one twice). For actually implementing what he said,
the fix should be quite simple, simply conditionally using CAIRO_FILTER_NEAREST
instead of CAIRO_FILTER_BEST in the case where the image width or height is
equal to 1.
Comment 9 Jeff Muizelaar 2006-02-16 08:18:13 UTC
*** Bug 5895 has been marked as a duplicate of this bug. ***
Comment 10 Jeff Muizelaar 2006-02-17 03:19:37 UTC
using CAIRO_FILTER_NEAREST doesn't work because lines will disapear if they are
scaled to dimensions that cairo doesn't like.
Comment 11 Jeff Muizelaar 2006-02-17 04:29:18 UTC
Created attachment 4634 [details] [review]
patch that should fix the problem

Works around the cairo problems by drawing rectangles for 1x1 images.
Comment 12 Jeff Muizelaar 2006-02-17 06:45:05 UTC
Fixed in cvs
Comment 13 Nickolay V. Shmyrev 2007-05-07 20:36:08 UTC
Cairo bug 5904

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.