]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 6 Apr 2014 15:09:41 +0000 (15:09 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 6 Apr 2014 15:09:41 +0000 (15:09 +0000)
coders/webp.c

index f9afc252f3db0fa51348c80382cb250a43893a94..95ac4c9065da11c57c421ca8e6a41a8437779537 100644 (file)
@@ -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);