[Spice-devel] [PATCH 4/6] LZ4: Decode the image format from the stream

Christophe Fergeau cfergeau at redhat.com
Fri Jan 23 08:00:24 PST 2015


ACK

On Thu, Jan 22, 2015 at 05:21:22PM +0100, Javier Celaya wrote:
> ---
>  common/canvas_base.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/common/canvas_base.c b/common/canvas_base.c
> index ec83123..c45d535 100644
> --- a/common/canvas_base.c
> +++ b/common/canvas_base.c
> @@ -568,6 +568,8 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image, int
>      uint8_t *dest, *data, *data_end;
>      int width, height, top_down;
>      LZ4_streamDecode_t *stream;
> +    uint8_t spice_format;
> +    pixman_format_code_t format;
>  
>      spice_chunks_linearize(image->u.lz4.data);
>      data = image->u.lz4.data->chunk[0].data;
> @@ -575,12 +577,28 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image, int
>      width = image->descriptor.width;
>      height = image->descriptor.height;
>      top_down = *(data++);
> +    spice_format = *(data++);
> +    switch (spice_format) {
> +        case SPICE_BITMAP_FMT_16BIT:
> +            format = PIXMAN_x1r5g5b5;
> +            break;
> +        case SPICE_BITMAP_FMT_24BIT:
> +        case SPICE_BITMAP_FMT_32BIT:
> +            format = PIXMAN_x8r8g8b8;
> +            break;
> +        case SPICE_BITMAP_FMT_RGBA:
> +            format = PIXMAN_a8r8g8b8;
> +            break;
> +        default:
> +            spice_warning("Unsupported bitmap format %d with LZ4\n", spice_format);
> +            return NULL;
> +    }
>  
>      surface = surface_create(
>  #ifdef WIN32
>                               canvas->dc,
>  #endif
> -                             PIXMAN_a8r8g8b8,
> +                             format,
>                               width, height, top_down);
>      if (surface == NULL) {
>          spice_warning("create surface failed");
> -- 
> 1.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150123/b8fe798a/attachment.sig>


More information about the Spice-devel mailing list