[cairo] Recording surfaces fail to replay onto SVG surfaces

Adrian Johnson ajohnson at redneon.com
Sat Oct 14 10:31:19 UTC 2017

On 12/10/17 21:01, Antonio Ospite wrote:
> On Thu, 5 Oct 2017 20:54:53 +1030
> ajohnson at redneon.com (Adrian Johnson) wrote:
>> I've pushed a fix for painting unbounded recordings to the SVG surface.
> Hi
> I too experienced a similar problem recently.
> The changes in 5a9dba9929d9 seem to fix the original test case of
> replaying to an SVG surface, but only for the first time: I noticed that
> replaying a second time still fails, producing an empty SVG.
> BTW, these seems to be regressions as 1.14.10 works fine in both cases.
> I also noticed that the generated files look a little different when
> using the current master: groups and links are used for the replayed
> surfaces, while with 1.14.10 the replayed elements are drawn ungrouped,
> I don't know if the regression is related to this change.

In recent versions, unbounded recording surfaces are emitted as a group
instead of replaying the drawing operations. This allows the group to be
emitted once and used multiple times.

The problem is the SVG backend marks a surface as emitted by setting a
user_data key on the surface. This prevents the surface from being
reused on another SVG file.

I've pushed a fix that uses a hash table to tracked emitted surfaces the
same way as the PDF backend. The fix also includes the support for
CAIRO_MIME_TYPE_UNIQUE_ID that is in the PDF backend.

More information about the cairo mailing list