Bug 41462 - [patch] pdftops 0.18.0 gets errors on patterns with PaintType 2
Summary: [patch] pdftops 0.18.0 gets errors on patterns with PaintType 2
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: utils (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 13:04 UTC by William Bader
Modified: 2011-10-13 13:58 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
patch against 0.18.0 (after applying the patch for bug 41374) (1.07 KB, patch)
2011-10-04 13:04 UTC, William Bader
Details | Splinter Review
patch against the original 0.18.0 (combines the patch for bug 41374) (1.62 KB, patch)
2011-10-04 13:07 UTC, William Bader
Details | Splinter Review
pdf that shows the problem (2.99 KB, application/pdf)
2011-10-04 13:11 UTC, William Bader
Details
postscript source of the pdf (1.27 KB, application/ps)
2011-10-04 13:14 UTC, William Bader
Details
0003-ps-fix-uncolored-tiling-patterns.patch (8.80 KB, patch)
2011-10-07 04:24 UTC, Adrian Johnson
Details | Splinter Review
0003-ps-fix-uncolored-tiling-patterns.patch (4.40 KB, patch)
2011-10-07 21:42 UTC, Adrian Johnson
Details | Splinter Review

Description William Bader 2011-10-04 13:04:43 UTC
Created attachment 51973 [details] [review]
patch against 0.18.0 (after applying the patch for bug 41374)

The postscript generated by pdftops gets errors on tiling patterns with PaintType 2.  In PaintType 2 patterns, the pattern is uncolored, and you set the color when you use the pattern.  The level 1 version created a font and used setcachedevice (which builds a color into the font) instead of setcharwidth.  The level 2 version didn't push the current color on the stack which lead to a stack underflow error.  When the setpattern operator is called with a pattern with PaintType 2, it looks for the paint color on the stack.
Comment 1 William Bader 2011-10-04 13:07:31 UTC
Created attachment 51974 [details] [review]
patch against the original 0.18.0 (combines the patch for bug 41374)
Comment 2 William Bader 2011-10-04 13:11:42 UTC
Created attachment 51975 [details]
pdf that shows the problem
Comment 3 William Bader 2011-10-04 13:14:24 UTC
Created attachment 51976 [details]
postscript source of the pdf

I made the pdf by running this postscript file through gs9.04 ps2pdf.
It is based on an example in the postscript language reference manual.
Comment 4 Albert Astals Cid 2011-10-06 02:50:39 UTC
Can this be regtested without applying the patch of 41374 or better wait until we fix that issue?
Comment 5 Adrian Johnson 2011-10-06 06:29:32 UTC
(In reply to comment #4)
> Can this be regtested without applying the patch of 41374 or better wait until
> we fix that issue?

I suggest getting bug 41374 fixed first. I have found some problems with this patch and am working on a new patch.
Comment 6 Adrian Johnson 2011-10-07 04:24:31 UTC
Created attachment 52078 [details] [review]
0003-ps-fix-uncolored-tiling-patterns.patch

The patch in comment 0 worked with gs but failed when printing. The problem is that color operators must not be used inside uncolored patterns/type3 chars.

This patch disables the use of color setting operators when uncolored patterns and type 3 chars are emitted. I've successfully tested this patch with the pdf in comment 2 on three different PostScript printers.
Comment 7 William Bader 2011-10-07 11:47:14 UTC
I applied the 0001 and 0002 patches from bug 41374 and the 0003 patch here (retesting after each patch), and the combination appears to work for all of my test files.

The pdfSetColor change adds a little bit of overhead for the test before every color operator.  Is it necessary or is it just working around a deeper problem that could be solved through a variable in poppler rather than a variable in the generated postscript?

William
Comment 8 Adrian Johnson 2011-10-07 21:42:59 UTC
Created attachment 52104 [details] [review]
0003-ps-fix-uncolored-tiling-patterns.patch

I've update patch 0003 to use a flag in PSOutputDev instead of in the PS prolog. Could you test is this prevents the slow down in your tests.
Comment 9 William Bader 2011-10-07 23:48:16 UTC
I tested the updated 0003 patch, and it seems to work for all of my test files.
Compared to a git snapshot from Aug 12, the level1 output is the same, while the level2 output is better, plus the PaintType 2 test works.
I don't have a method accurate enough to time the difference processing the generated postscript of the two versions of 0003.
Comment 10 Albert Astals Cid 2011-10-13 13:58:46 UTC
Patches commited


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.