[PATCH] Support on-the-fly transparency changes in pixman renderer

Pekka Paalanen ppaalanen at gmail.com
Sun Apr 6 23:40:23 PDT 2014


On Sat,  5 Apr 2014 05:31:37 +0200
Manuel Bachmann <manuel.bachmann at open.eurogiciel.org> wrote:

> 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.

A minor nitpick here. The term "alpha channel" refers to the per-pixel
alpha values in the buffer. Instead, we should talk about "surface
alpha" or "full surface alpha" or "surface transparency" or something
like that here, because you are using the single alpha value that
affects the whole surface in addition to the alpha channel in the
content.


Thanks,
pq

> 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 at open.eurogiciel.org>
> ---
>  src/pixman-renderer.c |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
> index b999343..eff7201 100644
> --- a/src/pixman-renderer.c
> +++ b/src/pixman-renderer.c
> @@ -340,9 +340,16 @@ repaint_region(struct weston_view *ev, struct weston_output *output,
>  	if (ps->buffer_ref.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,
>  				 ps->image, /* src */
> -				 NULL /* mask */,
> +				 mask_image, /* mask */
>  				 po->shadow_image, /* dest */
>  				 0, 0, /* src_x, src_y */
>  				 0, 0, /* mask_x, mask_y */



More information about the wayland-devel mailing list