From 02a2baa8dcf49ad2d9766d43578ba216fab0d464 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 29 Jan 2013 02:51:25 +0000 Subject: xlib/shm: Tidy creation of the proxy source for ShmPixmaps Signed-off-by: Chris Wilson --- src/cairo-xlib-source.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c index ca552785..0cc32e8e 100644 --- a/src/cairo-xlib-source.c +++ b/src/cairo-xlib-source.c @@ -955,18 +955,14 @@ surface_source (cairo_xlib_surface_t *dst, _cairo_xlib_shm_surface_get_pixmap (src)) { cairo_xlib_proxy_t *proxy; - cairo_surface_reference (src); - proxy = malloc (sizeof(*proxy)); - if (unlikely (proxy == NULL)) { - cairo_surface_destroy (src); + if (unlikely (proxy == NULL)) return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY); - } _cairo_surface_init (&proxy->source.base, &cairo_xlib_proxy_backend, dst->base.device, - CAIRO_CONTENT_COLOR_ALPHA); + src->content); proxy->source.dpy = dst->display->display; proxy->source.picture = XRenderCreatePicture (proxy->source.dpy, @@ -979,7 +975,7 @@ surface_source (cairo_xlib_surface_t *dst, proxy->source.has_matrix = 0; proxy->source.filter = CAIRO_FILTER_NEAREST; proxy->source.extend = CAIRO_EXTEND_NONE; - proxy->owner = src; + proxy->owner = cairo_surface_reference (src); return embedded_source (dst, pattern, extents, src_x, src_y, &proxy->source); -- cgit v1.2.3