[cairo-commit] libpixman/src ictrap.c,1.24,1.25

Keith Packard commit at pdx.freedesktop.org
Thu May 12 20:25:09 PDT 2005


Committed by: keithp

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

Modified Files:
	ictrap.c 
Log Message:
2005-05-12  Keith Packard  <keithp at keithp.com>

	reviewed by: cworth

	* src/ictrap.c: (pixman_composite_trapezoids):
	libpixman creates an A8 format object and sometimes forgets to
	destroy (when the bounds of the trapezoids are empty).
	Avoids creating the format object in that case.


Index: ictrap.c
===================================================================
RCS file: /cvs/cairo/libpixman/src/ictrap.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- ictrap.c	4 Mar 2005 15:53:09 -0000	1.24
+++ ictrap.c	13 May 2005 03:25:07 -0000	1.25
@@ -139,10 +139,6 @@
     xDst = traps[0].left.p1.x >> 16;
     yDst = traps[0].left.p1.y >> 16;
     
-    format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
-    if (!format)
-	return;
-
     pixman_trapezoid_bounds (ntraps, traps, &traps_bounds);
 
     traps_region = pixman_region_create_simple (&traps_bounds);
@@ -167,11 +163,18 @@
     if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
 	return;
 
+    format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
+    if (!format)
+	return;
+
     image = IcCreateAlphaPicture (dst, format,
 				  bounds.x2 - bounds.x1,
 				  bounds.y2 - bounds.y1);
     if (!image)
+    {
+	pixman_format_destroy (format);
 	return;
+    }
 
     for (; ntraps; ntraps--, traps++)
     {




More information about the cairo-commit mailing list