Bug 95235

Summary: Cairo 1.14.4: wrong rasterization for concave shapes with cairo_mesh_pattern
Product: cairo Reporter: s.brodacka
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED NOTABUG QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: minimal example

Description s.brodacka 2016-05-02 08:02:41 UTC
Created attachment 123402 [details]
minimal example

Cairo sometimes cuts the concavity of shape if the cairo_mesh_pattern is used for rasterization. It looks like extra point is created on the shape to close the pattern and additional shape is rasterized to fill it.
If the standard drawing method is used the shape is fine.
Minimal example of cairo_mesh_pattern (red) rasterization summarized with standard rasterization (black) showing the difference in rasterized shape is attached.
Comment 1 Adrian Johnson 2016-05-02 12:52:24 UTC
That is the correct rendering when the patch folds over. Confirmed by changing the surface to a PDF surface and checking the rendering of the generated PDF with both Ghostscript and Adobe Reader.

See figure 29, p195 of the PDF standard:

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf
Comment 2 s.brodacka 2016-05-05 09:27:54 UTC
(In reply to Adrian Johnson from comment #1)
> That is the correct rendering when the patch folds over. Confirmed by
> changing the surface to a PDF surface and checking the rendering of the
> generated PDF with both Ghostscript and Adobe Reader.
> 
> See figure 29, p195 of the PDF standard:
> 
> http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.
> pdf

Thank you for your answear. So is there a possibility to draw the exact shape using cairo_mesh_pattern?
Comment 3 Adrian Johnson 2016-05-05 09:41:21 UTC
If it is just one patch you could set a clip path around the patch.

The better solution would be to subdivide the patch to eliminate beziers that change direction.

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.