Bug 29968

Summary: Evince PDF seems to ignore /Matrix in /XObject
Product: poppler Reporter: Carlos Garcia Campos <carlosgc>
Component: cairo backendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: samtygier, stimberg
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: fix ctm when painting groups

Description Carlos Garcia Campos 2010-09-02 02:34:26 UTC
Bug forwarded from Evince: https://bugzilla.gnome.org/show_bug.cgi?id=628597

"The Story:
I had a pdf-image, that was rotated using pdftk. This image was included in a
pdflatex run as embedded image. The resulting pdf is correctly displayed in
Adobe Reader, but within Evince, this image is unrotated (off be 90°)...
Unfortunately I cannot give the example, but I'll try to come up with a
test-file within a few days...

For now, my analysis of the pdf shows that there is the following sequence
within the pdf:
12 0 obj <<
/Type /XObject
/Subtype /Form
/FormType 1
/PTEX.FileName (C:/the/path/to/rotated_picture.pdf)
/PTEX.PageNumber 1
/PTEX.InfoDict 28 0 R
/Matrix [0 -1 1 0 0 596.25]
/BBox [0 0 596.25 843]
/Group 13 0 R
/Resources <<
/ExtGState <<
/s5 29 0 R
.....

My guess would be that Evince does not correctly parse the /Matrix for the
XObject, as the Matrix
0 -1
1 0
would correspond to the missing rotation...

Best regards,
Chewi"

Test case is attached to the original bug report. I confirm it works with splash.
Comment 1 Marcel Stimberg 2011-02-01 11:57:01 UTC
This issue is still reproducable with poppler 0.16.0, see this Ubuntu bug report for another example: https://bugs.launchpad.net/ubuntu/+source/evince/+bug/711300
Comment 2 Jose Aliste 2011-02-01 17:51:47 UTC
Indeed, we are ignoring the TransformationMatrix from the state in CairoOutputDev::BeginTransparencyGroup. Caching the state->getCTM() into a cairo_matrix_t and then calling cairo_set_matrix with this matrix at the begining of CairoOutputDev::PaintTransparencyGroup works when scale = 1 but (not surprisingly) does not scale properly when rendering at bigger scales.
Comment 3 Adrian Johnson 2012-01-16 03:14:31 UTC
Created attachment 55629 [details] [review]
fix ctm when painting groups

Patch to fix. Similar to the set soft mask bugs we need to store the current ctm during beginTransparencyGroup when the group is created and use this ctm when painting the group.
Comment 4 Adrian Johnson 2012-01-16 03:15:09 UTC
*** Bug 40596 has been marked as a duplicate of this bug. ***
Comment 5 Carlos Garcia Campos 2012-01-19 03:48:37 UTC
Comment on attachment 55629 [details] [review]
fix ctm when painting groups

Review of attachment 55629 [details] [review]:
-----------------------------------------------------------------

Patch looks good to me and it doesn't introduce regressions in my tests, so please, push it to both branches. Thanks!

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.