Bug 54526

Summary: Selection background color turns black
Product: poppler Reporter: Jason Crain <jason>
Component: cairo backendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: jason
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: example pdf
screenshot of error in evince
Update fill and stroke color in CairoOutputDev::startPage

Description Jason Crain 2012-09-05 04:51:48 UTC
Created attachment 66649 [details]
example pdf

The attached document contains the text "s ab".  While using evince, if I select, from left to right, the characters " ab" so that the space is the first character selected, the background color for the "a" turns black.
Comment 1 Jason Crain 2012-09-05 04:53:21 UTC
Created attachment 66650 [details]
screenshot of error in evince

Attached is an image of the rendering error from evince.
Comment 2 Jason Crain 2012-09-05 04:56:25 UTC
Created attachment 66651 [details] [review]
Update fill and stroke color in CairoOutputDev::startPage

The problem occurs because in CairoOutputDev.cc, the current fill color is kept in two variables: fill_pattern and fill_color.  CairoOutputDev::updateFillColor checks if fill_color has changed before updating fill_pattern.  But in CairoOutputDev::startPage, fill_pattern is set to black without updating fill_color.  When fill_color and fill_pattern become desynchronized, updateFillColor may fail to update fill_pattern, leaving the pattern black.  The same is true for the stroke_pattern and stroke_color variables, but I have not seen any problem caused by that.

Attached patch fixes this problem by updating fill_color and stroke_color in startPage, to keep them in sync with fill_pattern and stroke_pattern.
Comment 3 Carlos Garcia Campos 2012-11-24 13:55:06 UTC
Sorry for the delay reviewing this too, patch pushed to git master, thank you very much.

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.