Index: ChangeLog =================================================================== RCS file: /mirrors/freedesktop/cairo/libpixman/ChangeLog,v retrieving revision 1.57 diff -u -p -r1.57 ChangeLog --- ChangeLog 4 Mar 2005 15:31:49 -0000 1.57 +++ ChangeLog 4 Mar 2005 15:49:26 -0000 @@ -1,5 +1,11 @@ 2005-03-04 Carl Worth + * src/ictrap.c (pixman_composite_trapezoids): Intersect bounds of + trapezoids with the bounds of the destination surface before + creating an intermediate surface. + +2005-03-04 Carl Worth + * src/ictrap.c (pixman_composite_trapezoids): Add comment from xserver's mitrap.c. Index: src/ictrap.c =================================================================== RCS file: /mirrors/freedesktop/cairo/libpixman/src/ictrap.c,v retrieving revision 1.23 diff -u -p -r1.23 ictrap.c --- src/ictrap.c 4 Mar 2005 15:31:49 -0000 1.23 +++ src/ictrap.c 4 Mar 2005 15:32:32 -0000 @@ -117,7 +117,8 @@ pixman_composite_trapezoids (pixman_oper int ntraps) { pixman_image_t *image = NULL; - pixman_box16_t bounds; + pixman_box16_t traps_bounds, dst_bounds, bounds; + pixman_region16_t *traps_region, *dst_region; int16_t xDst, yDst; int16_t xRel, yRel; pixman_format_t *format; @@ -142,9 +143,30 @@ pixman_composite_trapezoids (pixman_oper if (!format) return; - pixman_trapezoid_bounds (ntraps, traps, &bounds); + pixman_trapezoid_bounds (ntraps, traps, &traps_bounds); + + traps_region = pixman_region_create_simple (&traps_bounds); + + /* XXX: If the image has a clip region set, we should really be + * fetching it here instead, but it looks like we don't yet expose + * a pixman_image_get_clip_region function. */ + dst_bounds.x1 = 0; + dst_bounds.y1 = 0; + dst_bounds.x2 = pixman_image_get_width (dst); + dst_bounds.y2 = pixman_image_get_height (dst); + + dst_region = pixman_region_create_simple (&dst_bounds); + + pixman_region_intersect (traps_region, traps_region, dst_region); + + bounds = *(pixman_region_extents (traps_region)); + + pixman_region_destroy (traps_region); + pixman_region_destroy (dst_region); + if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) return; + image = IcCreateAlphaPicture (dst, format, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);