Bug 24805

Summary: duplicated XObjects with subtype image in PDF Output
Product: cairo Reporter: clark <wzhu>
Component: pdf backendAssignee: Adrian Johnson <ajohnson>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: major    
Priority: medium CC: carlosgc, chris
Version: 1.10.0   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description clark 2009-10-29 20:16:45 UTC
Last time I logged one issue for duplicated XObjects with subtype image by Cairo 1.8.8.Chris advised me to use the new version of Cairo 1.9.4, which should address this problem.

I just use the Cairo 1.9.4 to generate the pdf output. After I did a simple test and went tthrough the cairo output, I still found many dulplicated objects.

Take object 213 and 216 in the attachment for example. They are duplicated with each object.Can anyone take a look whether we can eliminate the redudant objects.
Comment 1 Carlos Garcia Campos 2010-09-08 03:19:21 UTC
It seems we are using the unique id of the image surface as the hash key for the surfaces cache, however it's possible to add the same image multiple times using different cairo surfaces. We would need to use the image contents (or even better the mime data if it exists) to make sure we don't duplicate image xobjects.
Comment 2 Adrian Johnson 2010-11-22 05:53:36 UTC
Fix in git master

http://cgit.freedesktop.org/cairo/commit/?id=9862c38fc71c6dcd444da3b079e5404cd14594c3

A new mime type CAIRO_MIME_TYPE_UNIQUE_ID has been added. Surfaces with the same unique id will only be embedded once even if different surfaces are created. We've offloaded the job of identifying different surfaces with the same content to the application. You can put what ever you want in the UNIQUE_ID to uniquely identify the surface. eg a filename or SHA1 hash.

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.