[Mesa-dev] [PATCH 04/13] mesa formats: unpack ARGB8888/XRGB8888
Brian Paul
brianp at vmware.com
Tue Jun 26 14:35:00 PDT 2012
On 06/25/2012 06:34 PM, Jordan Justen wrote:
> Signed-off-by: Jordan Justen<jordan.l.justen at intel.com>
> ---
> src/mesa/main/format_unpack.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
> index c42bac1..d1daae5 100644
> --- a/src/mesa/main/format_unpack.c
> +++ b/src/mesa/main/format_unpack.c
> @@ -2139,6 +2139,32 @@ unpack_int_rgba_RGBA_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
> }
>
> static void
> +unpack_int_rgba_ARGB8888(const GLbyte *src, GLuint dst[][4], GLuint n)
I think a more descriptive name would have the suffix _INT similar to
the other functions.
> +{
> + unsigned int i;
> +
> + for (i = 0; i< n; i++) {
> + dst[i][RCOMP] = (GLubyte) src[i * 4 + 2];
> + dst[i][GCOMP] = (GLubyte) src[i * 4 + 1];
> + dst[i][BCOMP] = (GLubyte) src[i * 4 + 0];
> + dst[i][ACOMP] = (GLubyte) src[i * 4 + 3];
> + }
> +}
> +
> +static void
> +unpack_int_rgba_XRGB8888(const GLbyte *src, GLuint dst[][4], GLuint n)
_INT8 suffixe here too.
> +{
> + unsigned int i;
> +
> + for (i = 0; i< n; i++) {
> + dst[i][RCOMP] = (GLubyte) src[i * 4 + 2];
> + dst[i][GCOMP] = (GLubyte) src[i * 4 + 1];
> + dst[i][BCOMP] = (GLubyte) src[i * 4 + 0];
> + dst[i][ACOMP] = (GLubyte) 0xff;
> + }
> +}
> +
> +static void
> unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
> {
> unsigned int i;
> @@ -2590,6 +2616,14 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
> unpack_int_rgba_RGBA_INT8(src, dst, n);
> break;
>
> + case MESA_FORMAT_ARGB8888:
> + unpack_int_rgba_ARGB8888(src, dst, n);
> + break;
> +
> + case MESA_FORMAT_XRGB8888:
> + unpack_int_rgba_XRGB8888(src, dst, n);
> + break;
> +
> case MESA_FORMAT_RGB_UINT32:
> case MESA_FORMAT_RGB_INT32:
> unpack_int_rgba_RGB_UINT32(src, dst, n);
Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list