summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmanuele Aina <emanuele.aina@collabora.com>2014-10-31 12:29:07 (GMT)
committerEmanuele Aina <emanuele.aina@collabora.com>2014-10-31 12:29:07 (GMT)
commit5f0002333ec869d5809558c147db0126ab8a4283 (patch)
tree51f897f866ddfbf1861aa18f321c6c7ca0f538e6
parentc703179e9a474833b9b73516e08d1996b8761cf0 (diff)
downloadcairo-5f0002333ec869d5809558c147db0126ab8a4283.tar.gz
cairo-5f0002333ec869d5809558c147db0126ab8a4283.tar.xz
xlib: Use the dest pixman format and composite if it doesn't match the source oneem/RPI-427-breaks-image-surface-format
Get the correct pixman format for the destination xlib surface and handle the case where it does not match the source format by compositing instead of blitting.
-rw-r--r--src/cairo-xlib-render-compositor.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c
index 68e7ce5..e5ac968 100644
--- a/src/cairo-xlib-render-compositor.c
+++ b/src/cairo-xlib-render-compositor.c
@@ -311,12 +311,11 @@ draw_image_boxes (void *_dst,
_cairo_box_round_to_rectangle (&extents, &r);
shm = (cairo_image_surface_t *)
- _cairo_xlib_surface_create_shm (dst, image->pixman_format,
+ _cairo_xlib_surface_create_shm (dst, _pixman_format_for_xlib_surface (dst),
r.width, r.height);
if (shm) {
int tx = -r.x, ty = -r.y;
- assert (shm->pixman_format == image->pixman_format);
for (chunk = &boxes->chunks; chunk; chunk = chunk->next) {
for (i = 0; i < chunk->count; i++) {
cairo_box_t *b = &chunk->base[i];
@@ -326,7 +325,8 @@ draw_image_boxes (void *_dst,
r.width = _cairo_fixed_integer_part (b->p2.x) - r.x;
r.height = _cairo_fixed_integer_part (b->p2.y) - r.y;
- if (! pixman_blt ((uint32_t *)image->data, (uint32_t *)shm->data,
+ if (shm->pixman_format != image->pixman_format ||
+ ! pixman_blt ((uint32_t *)image->data, (uint32_t *)shm->data,
image->stride / sizeof (uint32_t),
shm->stride / sizeof (uint32_t),
PIXMAN_FORMAT_BPP (image->pixman_format),