[PATCH] render: Add support for RENDER RGBA formats

Keith Packard keithp at keithp.com
Thu Sep 11 17:40:03 PDT 2014


Damien Leone <dleone at nvidia.com> writes:

> diff --git a/render/picture.c b/render/picture.c
> index 58535d4..d060bc2 100644
> --- a/render/picture.c
> +++ b/render/picture.c
> @@ -201,6 +201,12 @@ PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp)
>      formats[nformats].format = PICT_b8g8r8x8;
>      formats[nformats].depth = 32;
>      nformats++;
> +    formats[nformats].format = PICT_r8g8b8a8;
> +    formats[nformats].depth = 32;
> +    nformats++;
> +    formats[nformats].format = PICT_r8g8b8x8;
> +    formats[nformats].depth = 32;
> +    nformats++;

I don't think adding these as default formats is going to be as useful
as you'd like; applications looking for a format with alpha will
probably be using the Xrender libary 'standard' ARGB32 format or
equivalent. Expecting applications to find RGBA and do the byte swapping
on images themselves is probably asking too much.

> @@ -672,12 +708,14 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
>              if ((formats[n].direct.redMask |
>                   formats[n].direct.blueMask | formats[n].direct.greenMask) == 0)
>                  type = PICT_TYPE_A;
> -            else if (formats[n].direct.red > formats[n].direct.blue)
> +            else if (formats[n].direct.blue == 0)
>                  type = PICT_TYPE_ARGB;
>              else if (formats[n].direct.red == 0)
>                  type = PICT_TYPE_ABGR;
> -            else
> +            else if (formats[n].direct.blue > formats[n].direct.red)
>                  type = PICT_TYPE_BGRA;
> +            else
> +                type = PICT_TYPE_RGBA;

yeah, that's kinda icky, but it looks like it will work for the formats
we have today.

I'd remove the standard format stuff and expect that your visuals will
construct the necessary formats on the fly; otherwise, this looks OK to
me.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140911/38cda156/attachment.sig>


More information about the xorg-devel mailing list