[Swfdec] 3 commits - libswfdec/swfdec_image.c libswfdec/swfdec_image.h

Riccardo Magliocchetti riccardo at datahost.it
Sun Nov 11 01:07:04 PST 2007


On Sat, 10 Nov 2007 15:22:02 -0800 (PST) company at kemper.freedesktop.org
(Benjamin Otte) wrote:

> commit c70f8bcfe8de80b2562359fc44c781789d99442a
> Author: Benjamin Otte <otte at gnome.org>
> Date:   Sat Nov 10 23:41:50 2007 +0100
> 
>     add swfdec_image_new () for images loaded from files
>     
>     Also adds stubs for PNG loading
> 
> diff --git a/libswfdec/swfdec_image.c b/libswfdec/swfdec_image.c
> index 4932882..7dcb879 100644
> --- a/libswfdec/swfdec_image.c
> +++ b/libswfdec/swfdec_image.c
[snip]
> @@ -660,3 +669,33 @@ swfdec_image_create_surface_transformed
> (SwfdecImage *image, const SwfdecColorTr cairo_surface_set_user_data
> (surface, &key, tdata, g_free); return surface;
>  }
> +
> +SwfdecImage *
> +swfdec_image_new (SwfdecBuffer *buffer)
> +{
> +  SwfdecImage *image;
> +  SwfdecImageType type;
> +
> +  g_return_val_if_fail (buffer != NULL, NULL);
> +
> +  /* check type of the image */
> +  if (buffer->length < 4)
> +    goto fail;
> +  if (buffer->data[0] == 0xFF && buffer->data[1] == 0xD8)
> +    type = SWFDEC_IMAGE_TYPE_JPEG2;
> +  else if (buffer->data[0] == 0xFF && buffer->data[1] == 0xD8 &&
> +      buffer->data[0] == 0xFF && buffer->data[1] == 0xD8)
> +    type = SWFDEC_IMAGE_TYPE_PNG;

I think you forgot to update the png test.

thanks,
Riccardo


More information about the Swfdec mailing list