dfb0a7420c
XXX: these patches should go away, or be fed upstream. A new major release 0.30.0 of the pixman rendering library is now available. Highlights of this release: - Support for high-quality image downscaling [Søren] - Much improved ARMv6 assembly [Ben Avison] - Improved rendering quality for gradients [Søren] - Improvements to the SSE2 backend [Chris Wilson, Siarhei Siamashka] - Improvements to MIPS DSPr2 backend [Nemanja Lukic] - Improvements to test suite [Siarhei, Søren Sandmann]
107 lines
2.9 KiB
Text
107 lines
2.9 KiB
Text
$NetBSD: patch-bc,v 1.4 2013/05/24 13:28:04 wiz Exp $
|
|
|
|
--- pixman/pixman.c.orig 2013-04-18 05:03:32.000000000 +0000
|
|
+++ pixman/pixman.c
|
|
@@ -152,6 +152,57 @@ optimize_operator (pixman_op_t op,
|
|
return operator_table[op].opaque_info[is_dest_opaque | is_source_opaque];
|
|
}
|
|
|
|
+static void
|
|
+apply_workaround (pixman_image_t *image,
|
|
+ int32_t * x,
|
|
+ int32_t * y,
|
|
+ uint32_t ** save_bits,
|
|
+ int * save_dx,
|
|
+ int * save_dy)
|
|
+{
|
|
+ if (image && (image->common.flags & FAST_PATH_NEEDS_WORKAROUND))
|
|
+ {
|
|
+ /* Some X servers generate images that point to the
|
|
+ * wrong place in memory, but then set the clip region
|
|
+ * to point to the right place. Because of an old bug
|
|
+ * in pixman, this would actually work.
|
|
+ *
|
|
+ * Here we try and undo the damage
|
|
+ */
|
|
+ int bpp = PIXMAN_FORMAT_BPP (image->bits.format) / 8;
|
|
+ pixman_box32_t *extents;
|
|
+ uint8_t *t;
|
|
+ int dx, dy;
|
|
+
|
|
+ extents = pixman_region32_extents (&(image->common.clip_region));
|
|
+ dx = extents->x1;
|
|
+ dy = extents->y1;
|
|
+
|
|
+ *save_bits = image->bits.bits;
|
|
+
|
|
+ *x -= dx;
|
|
+ *y -= dy;
|
|
+ pixman_region32_translate (&(image->common.clip_region), -dx, -dy);
|
|
+
|
|
+ t = (uint8_t *)image->bits.bits;
|
|
+ t += dy * image->bits.rowstride * 4 + dx * bpp;
|
|
+ image->bits.bits = (uint32_t *)t;
|
|
+
|
|
+ *save_dx = dx;
|
|
+ *save_dy = dy;
|
|
+ }
|
|
+}
|
|
+
|
|
+static void
|
|
+unapply_workaround (pixman_image_t *image, uint32_t *bits, int dx, int dy)
|
|
+{
|
|
+ if (image && (image->common.flags & FAST_PATH_NEEDS_WORKAROUND))
|
|
+ {
|
|
+ image->bits.bits = bits;
|
|
+ pixman_region32_translate (&image->common.clip_region, dx, dy);
|
|
+ }
|
|
+}
|
|
+
|
|
/*
|
|
* Computing composite region
|
|
*/
|
|
@@ -588,6 +639,13 @@ pixman_image_composite32 (pixman_op_t
|
|
pixman_composite_info_t info;
|
|
const pixman_box32_t *pbox;
|
|
int n;
|
|
+ uint32_t *src_bits;
|
|
+ int src_dx, src_dy;
|
|
+ uint32_t *mask_bits;
|
|
+ int mask_dx, mask_dy;
|
|
+ uint32_t *dest_bits;
|
|
+ int dest_dx, dest_dy;
|
|
+ pixman_bool_t need_workaround;
|
|
|
|
_pixman_image_validate (src);
|
|
if (mask)
|
|
@@ -624,6 +682,16 @@ pixman_image_composite32 (pixman_op_t
|
|
src_format = mask_format = PIXMAN_rpixbuf;
|
|
}
|
|
|
|
+ /* Check for workaround */
|
|
+ need_workaround = (info.src_flags | info.mask_flags | info.dest_flags) & FAST_PATH_NEEDS_WORKAROUND;
|
|
+
|
|
+ if (need_workaround)
|
|
+ {
|
|
+ apply_workaround (src, &src_x, &src_y, &src_bits, &src_dx, &src_dy);
|
|
+ apply_workaround (mask, &mask_x, &mask_y, &mask_bits, &mask_dx, &mask_dy);
|
|
+ apply_workaround (dest, &dest_x, &dest_y, &dest_bits, &dest_dx, &dest_dy);
|
|
+ }
|
|
+
|
|
pixman_region32_init (®ion);
|
|
|
|
if (!_pixman_compute_composite_region32 (
|
|
@@ -710,6 +778,13 @@ pixman_image_composite32 (pixman_op_t
|
|
}
|
|
|
|
out:
|
|
+ if (need_workaround)
|
|
+ {
|
|
+ unapply_workaround (src, src_bits, src_dx, src_dy);
|
|
+ unapply_workaround (mask, mask_bits, mask_dx, mask_dy);
|
|
+ unapply_workaround (dest, dest_bits, dest_dx, dest_dy);
|
|
+ }
|
|
+
|
|
pixman_region32_fini (®ion);
|
|
}
|
|
|