Bug 70684 - Knockout cairo operator (SOURCE) is lost when nesting transparency groups
Summary: Knockout cairo operator (SOURCE) is lost when nesting transparency groups
Status: NEW
Alias: None
Product: poppler
Classification: Unclassified
Component: cairo backend (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-20 17:34 UTC by Michaël Cadilhac
Modified: 2013-10-20 17:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
The offending PDF (1.63 KB, application/pdf)
2013-10-20 17:34 UTC, Michaël Cadilhac
Details
Faulty behavior (30.05 KB, image/png)
2013-10-20 17:39 UTC, Michaël Cadilhac
Details
Expected behavior (29.73 KB, image/png)
2013-10-20 17:39 UTC, Michaël Cadilhac
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michaël Cadilhac 2013-10-20 17:34:36 UTC
Created attachment 87884 [details]
The offending PDF

IMPORTANT NOTE: for this PDF to be even displayed, one should first fix #70671 (I propose a simple fix therein).

In the attached PDF, the blue line should be displayed when behind the yellow line.  The yellow line is the last element of a knockout transparency group which includes another group containing the blue line.  The transparency of the yellow line should be based on the original backdrop of the group (i.e., the empty page).

The problem is caused by the restoration of the graphic state in Gfx::drawForm (Gfx.cc:4947).  It calls CairoOutputDev::restoreState which, instead of letting cairo restore the current operator, sets it using CairoOutputDev::updateBlendMode.  Hence while the first elements of a knockout groups are drawn using the right operator, i.e., CAIRO_OPERATOR_SOURCE, after a nested group appears, the operator is reset (most probably to CAIRO_OPERATOR_OVER, corresponding to Normal blend mode).

I fixed this in my local repo by moving the call to updateBlendMode from restoreState to paintTransparencyGroup.  I am not sure this is the perfect fix, but it does work for my test case.
Comment 1 Michaël Cadilhac 2013-10-20 17:36:31 UTC
Sorry, I should proofread myself a little more.  "the blue line should be displayed" is to be read "the blue line should not be displayed" (see forthcoming screenshots).
Comment 2 Michaël Cadilhac 2013-10-20 17:39:23 UTC
Created attachment 87885 [details]
Faulty behavior
Comment 3 Michaël Cadilhac 2013-10-20 17:39:45 UTC
Created attachment 87886 [details]
Expected behavior


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.