Bug 41005

Summary: setSoftMask does not with with rotated or translated ctm
Product: poppler Reporter: Adrian Johnson <ajohnson>
Component: cairo backendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: michael.s.gilbert, rick.born
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: test case
fix setSoftMask
fix softmask
fix softmask bug when the ctm changes
save mask matrix on mask stack
ensure mask matrix is always set when mask is set
0005-cairo-implement-transfer-function-in-setSoftMask.patch

Description Adrian Johnson 2011-09-19 04:56:54 UTC
Test case attached. The problem is CairoOutputDev::setSoftMask creates in image mask using the clip extents transformed to device space. There are two bugs:

- The transformation of clip extents to device space is only transforming two corners then getting the bounding box around the two corners. If, for example, the clip extents is a square rotated 45 degrees, the bounding box around the two transformed corners is now a straight line.

- The mask surface origin starts at the clip extents origin, not (0,0). But there is no translation applied when painting the source onto the mask surface to compensate for the non zero origin.
Comment 1 Adrian Johnson 2011-09-19 04:57:29 UTC
Created attachment 51331 [details]
test case
Comment 2 Adrian Johnson 2011-09-19 04:58:52 UTC
Created attachment 51332 [details] [review]
fix setSoftMask

Patch to fix this bug.
Comment 3 Carlos Garcia Campos 2011-09-19 11:11:03 UTC
Thanks for the patch!. I've run the regtests with my pdfs and while it fixes some documents, it breaks others too.

http://acroeng.adobe.com/Test_Files/images/a_Opera.pdf
http://acroeng.adobe.com/Test_Files/OCG/ClarityOCGs.pdf
 - It removes a shadow

discover_ireland_Boyne-Valley-Brochure-Interactive-V2-0-.pdf
 - It fixes this document, I don't remember where I got this, so I don't know whether I can share it or not. Just let me know if you want it.

http://www.investigatemagazine.com/tgif8aug08.pdf
 - It fixes this one too (see diffs in page 8)
Comment 4 Adrian Johnson 2011-09-20 06:44:30 UTC
Created attachment 51403 [details] [review]
fix softmask

Updated patch to fix regression in previous patch.
Comment 5 Adrian Johnson 2011-09-23 06:23:22 UTC
*** Bug 32117 has been marked as a duplicate of this bug. ***
Comment 6 Adrian Johnson 2011-09-30 05:15:09 UTC
Created attachment 51792 [details] [review]
fix softmask bug when the ctm changes

I've found another bug in the cairo softmask code. It was not correctly handling the case where the ctm changes after the mask is created and before calling cairo_mask().

The attached patch fixes this. This fixes bug 28637. It also makes the ducks and roses pdf in bug 22098 render almost correctly. I'm still investigating the remaining issues with the ducks and roses pdf but it appears the problem is in cairo, not poppler.
Comment 7 Adrian Johnson 2011-10-02 04:18:58 UTC
Created attachment 51874 [details] [review]
save mask matrix on mask stack
Comment 8 Adrian Johnson 2011-10-02 04:19:23 UTC
Created attachment 51875 [details] [review]
ensure mask matrix is always set when mask is set
Comment 9 Adrian Johnson 2011-10-08 02:01:18 UTC
Created attachment 52110 [details] [review]
0005-cairo-implement-transfer-function-in-setSoftMask.patch

Implement the transfer function in setSoftMask.
Comment 10 Adrian Johnson 2011-10-17 01:36:01 UTC
Patches committed.
Comment 11 Adrian Johnson 2011-10-17 01:38:56 UTC
*** Bug 28637 has been marked as a duplicate of this bug. ***

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.