[cairo-commit] cairo/src cairo-glitz-surface.c,1.49,1.50

Carl Worth commit at pdx.freedesktop.org
Thu Jul 21 00:35:09 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv16542/src

Modified Files:
	cairo-glitz-surface.c 
Log Message:

        * src/cairo-glitz-surface.c:
        (_cairo_glitz_pattern_release_surface),
        (_cairo_glitz_pattern_acquire_surfaces),
        (_cairo_glitz_surface_composite),
        (_cairo_glitz_surface_composite_trapezoids),
        (_cairo_glitz_surface_show_glyphs): Finally grepped through and
        fixed up the last remaining calls to
        cairo_pattern_release_surface.


Index: cairo-glitz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- cairo-glitz-surface.c	8 Jul 2005 17:12:29 -0000	1.49
+++ cairo-glitz-surface.c	21 Jul 2005 07:35:07 -0000	1.50
@@ -688,13 +688,12 @@
 }
 
 static void
-_cairo_glitz_pattern_release_surface (cairo_glitz_surface_t	       *dst,
+_cairo_glitz_pattern_release_surface (cairo_pattern_t		      *pattern,
 				      cairo_glitz_surface_t	      *surface,
 				      cairo_glitz_surface_attributes_t *attr)
 {
     if (attr->acquired)
-	_cairo_pattern_release_surface (&dst->base, &surface->base,
-					&attr->base);
+	_cairo_pattern_release_surface (pattern, &surface->base, &attr->base);
     else
 	cairo_surface_destroy (&surface->base);
 }
@@ -760,13 +759,12 @@
 						       width, height,
 						       mask_out, mattr);
     
+	if (status)
+	    _cairo_glitz_pattern_release_surface (&tmp.base, *src_out, sattr);
+
 	_cairo_pattern_fini (&tmp.base);
 
-	if (status)
-	{
-	    _cairo_glitz_pattern_release_surface (dst, *src_out, sattr);
-	    return status;
-	}
+	return status;
     }
     else
     {
@@ -840,7 +838,7 @@
 	if (mask_attr.n_params)
 	    free (mask_attr.params);
 	
-	_cairo_glitz_pattern_release_surface (dst, mask, &mask_attr);
+	_cairo_glitz_pattern_release_surface (mask_pattern, mask, &mask_attr);
     }
     else
     {    
@@ -858,7 +856,7 @@
     if (src_attr.n_params)
 	free (src_attr.params);
 
-    _cairo_glitz_pattern_release_surface (dst, src, &src_attr);
+    _cairo_glitz_pattern_release_surface (src_pattern, src, &src_attr);
 
     if (glitz_surface_get_status (dst->surface) == GLITZ_STATUS_NOT_SUPPORTED)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -942,6 +940,8 @@
 					   cairo_trapezoid_t *traps,
 					   int		     n_traps)
 {
+    cairo_pattern_union_t tmp_src_pattern;
+    cairo_pattern_t *src_pattern;
     cairo_glitz_surface_attributes_t attributes;
     cairo_glitz_surface_t	     *dst = abstract_dst;
     cairo_glitz_surface_t	     *src;
@@ -959,16 +959,13 @@
 
     if (pattern->type == CAIRO_PATTERN_SURFACE)
     {
-	cairo_pattern_union_t tmp;
-
-	_cairo_pattern_init_copy (&tmp.base, pattern);
+	_cairo_pattern_init_copy (&tmp_src_pattern.base, pattern);
 	
-	status = _cairo_glitz_pattern_acquire_surface (&tmp.base, dst,
+	status = _cairo_glitz_pattern_acquire_surface (&tmp_src_pattern.base, dst,
 						       src_x, src_y,
 						       width, height,
 						       &src, &attributes);
-
-	_cairo_pattern_fini (&tmp.base);
+	src_pattern = &tmp_src_pattern.base;
     }
     else
     {
@@ -976,6 +973,7 @@
 						       src_x, src_y,
 						       width, height,
 						       &src, &attributes);
+	src_pattern = pattern;
     }
     alpha = 0xffff;
 
@@ -1006,7 +1004,10 @@
 						 2, 1);
 	if (!mask)
 	{
-	    _cairo_glitz_pattern_release_surface (dst, src, &attributes);
+	    _cairo_glitz_pattern_release_surface (src_pattern, src, &attributes);
+	    if (src_pattern == &tmp_src_pattern.base)
+		_cairo_pattern_fini (&tmp_src_pattern.base);
+
 	    return CAIRO_INT_STATUS_UNSUPPORTED;
 	}
 
@@ -1030,8 +1031,10 @@
 		data = realloc (data, data_size);
 		if (!data)
 		{
-		    _cairo_glitz_pattern_release_surface (dst, src,
+		    _cairo_glitz_pattern_release_surface (src_pattern, src,
 							  &attributes);
+		    if (src_pattern == &tmp_src_pattern.base)
+			_cairo_pattern_fini (&tmp_src_pattern.base);
 		    return CAIRO_STATUS_NO_MEMORY;
 		}
 
@@ -1041,8 +1044,10 @@
 		buffer = glitz_buffer_create_for_data (data);
 		if (!buffer) {
 		    free (data);
-		    _cairo_glitz_pattern_release_surface (dst, src,
+		    _cairo_glitz_pattern_release_surface (src_pattern, src,
 							  &attributes);
+		    if (src_pattern == &tmp_src_pattern.base)
+			_cairo_pattern_fini (&tmp_src_pattern.base);
 		    return CAIRO_STATUS_NO_MEMORY;
 		}
 	    }
@@ -1076,7 +1081,9 @@
 	data = malloc (stride * height);
 	if (!data)
 	{
-	    _cairo_glitz_pattern_release_surface (dst, src, &attributes);
+	    _cairo_glitz_pattern_release_surface (src_pattern, src, &attributes);
+	    if (src_pattern == &tmp_src_pattern.base)
+		_cairo_pattern_fini (&tmp_src_pattern.base);
 	    return CAIRO_STATUS_NO_MEMORY;
 	}
 
@@ -1106,7 +1113,7 @@
 						   width, height);
 	if (!mask)
 	{
-	    _cairo_glitz_pattern_release_surface (dst, src, &attributes);
+	    _cairo_glitz_pattern_release_surface (src_pattern, src, &attributes);
 	    free (data);
 	    cairo_surface_destroy (&image->base);
 	    return CAIRO_STATUS_NO_MEMORY;
@@ -1139,7 +1146,10 @@
     
     free (data);
 
-    _cairo_glitz_pattern_release_surface (dst, src, &attributes);
+    _cairo_glitz_pattern_release_surface (src_pattern, src, &attributes);
+    if (src_pattern == &tmp_src_pattern.base)
+	_cairo_pattern_fini (&tmp_src_pattern.base);
+
     if (mask)
 	cairo_surface_destroy (&mask->base);
 
@@ -2075,7 +2085,7 @@
     if (attributes.n_params)
 	free (attributes.params);
 
-    _cairo_glitz_pattern_release_surface (dst, src, &attributes);
+    _cairo_glitz_pattern_release_surface (pattern, src, &attributes);
 
     if (status)
 	return status;




More information about the cairo-commit mailing list