Support on-the-fly transparency changes in pixman renderer

When the alpha channel of a surface is changed and the surface
refreshed, pixman renderer will now apply a mask corresponding
to the alpha channel value.

This allows visual effects like shell fade in, shell fade out,
window switching, to work when using pixman renderer.

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
dev
Manuel Bachmann 11 years ago committed by Kristian Høgsberg
parent a46b946cb3
commit b1fff418a3
  1. 9
      src/pixman-renderer.c

@ -340,9 +340,16 @@ repaint_region(struct weston_view *ev, struct weston_output *output,
if (ps->buffer_ref.buffer) if (ps->buffer_ref.buffer)
wl_shm_buffer_begin_access(ps->buffer_ref.buffer->shm_buffer); wl_shm_buffer_begin_access(ps->buffer_ref.buffer->shm_buffer);
pixman_image_t *mask_image;
if (ev->alpha < 1.0) {
pixman_color_t mask = { 0x0000, 0x0000, 0x0000, 0xffff*ev->alpha };
mask_image = pixman_image_create_solid_fill(&mask);
} else
mask_image = NULL;
pixman_image_composite32(pixman_op, pixman_image_composite32(pixman_op,
ps->image, /* src */ ps->image, /* src */
NULL /* mask */, mask_image, /* mask */
po->shadow_image, /* dest */ po->shadow_image, /* dest */
0, 0, /* src_x, src_y */ 0, 0, /* src_x, src_y */
0, 0, /* mask_x, mask_y */ 0, 0, /* mask_x, mask_y */

Loading…
Cancel
Save