1 $NetBSD: patch-bc,v 1.2 2012/05/12 17:38:32 wiz Exp $
3 --- pixman/pixman.c.orig 2012-12-10 11:34:13.000000000 +0000
5 @@ -152,6 +152,57 @@ optimize_operator (pixman_op_t op,
6 return operator_table[op].opaque_info[is_dest_opaque | is_source_opaque];
10 +apply_workaround (pixman_image_t *image,
13 + uint32_t ** save_bits,
17 + if (image && (image->common.flags & FAST_PATH_NEEDS_WORKAROUND))
19 + /* Some X servers generate images that point to the
20 + * wrong place in memory, but then set the clip region
21 + * to point to the right place. Because of an old bug
22 + * in pixman, this would actually work.
24 + * Here we try and undo the damage
26 + int bpp = PIXMAN_FORMAT_BPP (image->bits.format) / 8;
27 + pixman_box32_t *extents;
31 + extents = pixman_region32_extents (&(image->common.clip_region));
35 + *save_bits = image->bits.bits;
39 + pixman_region32_translate (&(image->common.clip_region), -dx, -dy);
41 + t = (uint8_t *)image->bits.bits;
42 + t += dy * image->bits.rowstride * 4 + dx * bpp;
43 + image->bits.bits = (uint32_t *)t;
51 +unapply_workaround (pixman_image_t *image, uint32_t *bits, int dx, int dy)
53 + if (image && (image->common.flags & FAST_PATH_NEEDS_WORKAROUND))
55 + image->bits.bits = bits;
56 + pixman_region32_translate (&image->common.clip_region, dx, dy);
61 * Computing composite region
63 @@ -576,6 +627,13 @@ pixman_image_composite32 (pixman_op_t
64 uint32_t src_flags, mask_flags, dest_flags;
65 pixman_region32_t region;
66 pixman_box32_t extents;
69 + uint32_t *mask_bits;
70 + int mask_dx, mask_dy;
71 + uint32_t *dest_bits;
72 + int dest_dx, dest_dy;
73 + pixman_bool_t need_workaround;
74 pixman_implementation_t *imp;
75 pixman_composite_func_t func;
77 @@ -614,6 +672,16 @@ pixman_image_composite32 (pixman_op_t
78 src_format = mask_format = PIXMAN_rpixbuf;
81 + /* Check for workaround */
82 + need_workaround = (src_flags | mask_flags | dest_flags) & FAST_PATH_NEEDS_WORKAROUND;
84 + if (need_workaround)
86 + apply_workaround (src, &src_x, &src_y, &src_bits, &src_dx, &src_dy);
87 + apply_workaround (mask, &mask_x, &mask_y, &mask_bits, &mask_dx, &mask_dy);
88 + apply_workaround (dest, &dest_x, &dest_y, &dest_bits, &dest_dx, &dest_dy);
91 pixman_region32_init (®ion);
93 if (!_pixman_compute_composite_region32 (
94 @@ -707,6 +775,13 @@ pixman_image_composite32 (pixman_op_t
98 + if (need_workaround)
100 + unapply_workaround (src, src_bits, src_dx, src_dy);
101 + unapply_workaround (mask, mask_bits, mask_dx, mask_dy);
102 + unapply_workaround (dest, dest_bits, dest_dx, dest_dy);
105 pixman_region32_fini (®ion);