mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-25 11:50:16 +01:00
[pdf] Copy the glyphs for use within an smask group.
When constructing an smask group using PDF_SHOW_GLYPHS, we need a copy of the glyphs else they'll be freed be we use them (in _show_page()).
This commit is contained in:
parent
a74db7e7bc
commit
c0593d16c7
1 changed files with 8 additions and 1 deletions
|
|
@ -731,6 +731,8 @@ _cairo_pdf_smask_group_destroy (cairo_pdf_smask_group_t *group)
|
|||
cairo_pattern_destroy (group->source);
|
||||
if (group->mask)
|
||||
cairo_pattern_destroy (group->mask);
|
||||
if (group->glyphs)
|
||||
free (group->glyphs);
|
||||
if (group->scaled_font)
|
||||
cairo_scaled_font_destroy (group->scaled_font);
|
||||
free (group);
|
||||
|
|
@ -4627,7 +4629,12 @@ _cairo_pdf_surface_show_glyphs (void *abstract_surface,
|
|||
group->operation = PDF_SHOW_GLYPHS;
|
||||
group->source = cairo_pattern_reference (source);
|
||||
group->source_res = pattern_res;
|
||||
group->glyphs = glyphs;
|
||||
group->glyphs = _cairo_malloc_ab (num_glyphs, sizeof (cairo_glyph_t));
|
||||
if (group->glyphs == NULL) {
|
||||
_cairo_pdf_smask_group_destroy (group);
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
}
|
||||
memcpy (group->glyphs, glyphs, sizeof (cairo_glyph_t) * num_glyphs);
|
||||
group->num_glyphs = num_glyphs;
|
||||
group->scaled_font = cairo_scaled_font_reference (scaled_font);
|
||||
status = _cairo_pdf_surface_add_smask_group (surface, group);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue