mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-05 07:40:32 +01:00
Fix to accept a cairo_pattern_t rather than a cairo_surface_t as the primary argument.
Track change in _cairo_pattern_release_surface and also pass the appropriate pattern for each acquired surface. The previous backend mismatch was causing memory leaks. Remove stale comment. Add missing fclose to keep valgrind happy about memory leaks.
This commit is contained in:
parent
288f0f7f49
commit
3cd006bb2b
6 changed files with 36 additions and 9 deletions
19
ChangeLog
19
ChangeLog
|
|
@ -1,3 +1,22 @@
|
|||
2005-07-14 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairoint.h:
|
||||
* src/cairo-pattern.c: (_cairo_pattern_release_surface): Fix to
|
||||
accept a cairo_pattern_t rather than a cairo_surface_t as the
|
||||
primary argument.
|
||||
|
||||
* src/cairo-image-surface.c: (_cairo_image_surface_composite),
|
||||
(_cairo_image_surface_composite_trapezoids): Track change in
|
||||
_cairo_pattern_release_surface and also pass the appropriate
|
||||
pattern for each acquired surface. The previous backend mismatch
|
||||
was causing memory leaks.
|
||||
|
||||
* src/cairo-xlib-surface.c: (_get_image_surface): Remove stale
|
||||
comment.
|
||||
|
||||
* test/xlib-surface.c: (main): Add missing fclose to keep valgrind
|
||||
happy about memory leaks.
|
||||
|
||||
2005-07-14 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* test/cairo-test.c: (cairo_test_expecting),
|
||||
|
|
|
|||
|
|
@ -595,9 +595,9 @@ _cairo_image_surface_composite (cairo_operator_t operator,
|
|||
}
|
||||
|
||||
if (mask)
|
||||
_cairo_pattern_release_surface (&dst->base, &mask->base, &mask_attr);
|
||||
_cairo_pattern_release_surface (mask_pattern, &mask->base, &mask_attr);
|
||||
|
||||
_cairo_pattern_release_surface (&dst->base, &src->base, &src_attr);
|
||||
_cairo_pattern_release_surface (src_pattern, &src->base, &src_attr);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
@ -674,7 +674,7 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t operator,
|
|||
render_src_y + attributes.y_offset,
|
||||
(pixman_trapezoid_t *) traps, num_traps);
|
||||
|
||||
_cairo_pattern_release_surface (&dst->base, &src->base, &attributes);
|
||||
_cairo_pattern_release_surface (pattern, &src->base, &attributes);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1409,19 +1409,24 @@ _cairo_pattern_acquire_surface (cairo_pattern_t *pattern,
|
|||
/**
|
||||
* _cairo_pattern_release_surface:
|
||||
* @pattern: a #cairo_pattern_t
|
||||
* @info: pointer to #cairo_surface_attributes_t filled in by
|
||||
* _cairo_pattern_acquire_surface
|
||||
* @surface: a surface obtained by _cairo_pattern_acquire_surface
|
||||
* @attributes: attributes obtained by _cairo_pattern_acquire_surface
|
||||
*
|
||||
* Releases resources obtained by _cairo_pattern_acquire_surface.
|
||||
**/
|
||||
void
|
||||
_cairo_pattern_release_surface (cairo_surface_t *dst,
|
||||
_cairo_pattern_release_surface (cairo_pattern_t *pattern,
|
||||
cairo_surface_t *surface,
|
||||
cairo_surface_attributes_t *attributes)
|
||||
{
|
||||
if (attributes->acquired)
|
||||
{
|
||||
_cairo_surface_release_source_image (dst,
|
||||
cairo_surface_pattern_t *surface_pattern;
|
||||
|
||||
assert (pattern->type == CAIRO_PATTERN_SURFACE);
|
||||
surface_pattern = (cairo_surface_pattern_t *) pattern;
|
||||
|
||||
_cairo_surface_release_source_image (surface_pattern->surface,
|
||||
(cairo_image_surface_t *) surface,
|
||||
attributes->extra);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -450,7 +450,6 @@ _get_image_surface (cairo_xlib_surface_t *surface,
|
|||
}
|
||||
|
||||
/* Let the surface take ownership of the data */
|
||||
/* XXX: Can probably come up with a cleaner API here. */
|
||||
_cairo_image_surface_assume_ownership_of_data (image);
|
||||
ximage->data = NULL;
|
||||
XDestroyImage (ximage);
|
||||
|
|
|
|||
|
|
@ -1817,7 +1817,7 @@ _cairo_pattern_acquire_surface (cairo_pattern_t *pattern,
|
|||
cairo_surface_attributes_t *attributes);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_release_surface (cairo_surface_t *dst,
|
||||
_cairo_pattern_release_surface (cairo_pattern_t *pattern,
|
||||
cairo_surface_t *surface,
|
||||
cairo_surface_attributes_t *attributes);
|
||||
|
||||
|
|
|
|||
|
|
@ -221,11 +221,13 @@ main (void)
|
|||
dpy = XOpenDisplay (NULL);
|
||||
if (!dpy) {
|
||||
fprintf (log_file, "xlib-surface: Cannot open display, skipping\n");
|
||||
fclose (log_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!check_visual (dpy)) {
|
||||
fprintf (log_file, "xlib-surface: default visual is not RGB24 or BGR24, skipping\n");
|
||||
fclose (log_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -264,6 +266,8 @@ main (void)
|
|||
free (diff_data);
|
||||
|
||||
XCloseDisplay (dpy);
|
||||
|
||||
fclose (log_file);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue