From: cristy Date: Sun, 6 Apr 2014 15:09:41 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2489 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b22ab4169eaf09a11025547766150b081eefe13f;p=imagemagick --- diff --git a/coders/webp.c b/coders/webp.c index f9afc252f..95ac4c906 100644 --- a/coders/webp.c +++ b/coders/webp.c @@ -323,7 +323,7 @@ static Image *ReadWEBPImage(const ImageInfo *image_info, } if (IsWEBPImageLossless(stream,length) != MagickFalse) image->quality=100; - p=webp_image->u.RGBA.rgba; + p=(unsigned char *) webp_image->u.RGBA.rgba; for (y=0; y < (ssize_t) image->rows; y++) { register Quantum @@ -459,7 +459,22 @@ ModuleExport void UnregisterWEBPImage(void) % */ -static int WebPWriter(const unsigned char *stream,size_t length, +#if WEBP_ENCODER_ABI_VERSION >= 0x0100 +static int WebPEncodeProgress(int percent,const WebPPicture* picture) +{ + Image + *image; + + MagickBooleanType + status; + + image=(Image *) picture->custom_ptr; + status=SetImageProgress(image,SaveImageTag,percent-1,100); + return(status == MagickFalse ? 0 : 1); +} +#endif + +static int WebPEncodeWriter(const unsigned char *stream,size_t length, const WebPPicture *const picture) { Image @@ -515,8 +530,11 @@ static MagickBooleanType WriteWEBPImage(const ImageInfo *image_info, return(status); if ((WebPPictureInit(&picture) == 0) || (WebPConfigInit(&configure) == 0)) ThrowWriterException(ResourceLimitError,"UnableToEncodeImageFile"); - picture.writer=WebPWriter; + picture.writer=WebPEncodeWriter; picture.custom_ptr=(void *) image; +#if WEBP_ENCODER_ABI_VERSION >= 0x0100 + picture.progress_hook=WebPEncodeProgress; +#endif picture.stats=(&statistics); picture.width=(int) image->columns; picture.height=(int) image->rows; @@ -529,8 +547,8 @@ static MagickBooleanType WriteWEBPImage(const ImageInfo *image_info, configure.lossless=1; value=GetImageOption(image_info,"webp:lossless"); if (value != (char *) NULL) - configure.lossless=ParseCommandOption(MagickBooleanOptions,MagickFalse, - value); + configure.lossless=(int) ParseCommandOption(MagickBooleanOptions, + MagickFalse,value); value=GetImageOption(image_info,"webp:method"); if (value != (char *) NULL) configure.method=StringToInteger(value); @@ -567,8 +585,8 @@ static MagickBooleanType WriteWEBPImage(const ImageInfo *image_info, configure.filter_type=StringToInteger(value); value=GetImageOption(image_info,"webp:auto-filter"); if (value != (char *) NULL) - configure.autofilter=ParseCommandOption(MagickBooleanOptions,MagickFalse, - value); + configure.autofilter=(int) ParseCommandOption(MagickBooleanOptions, + MagickFalse,value); value=GetImageOption(image_info,"webp:alpha-compression"); if (value != (char *) NULL) configure.alpha_compression=StringToInteger(value);