]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 18 Mar 2013 23:55:01 +0000 (23:55 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 18 Mar 2013 23:55:01 +0000 (23:55 +0000)
MagickCore/image.c

index 55974729bd7736585bc90cb6918999b3697643c8..1050897de6367b45dc1f683d53f6cfb507295682 100644 (file)
@@ -3060,12 +3060,18 @@ MagickExport MagickBooleanType SetImageMask(Image *image,const Image *mask,
   if (mask == (const Image *) NULL)
     {
       image->mask=MagickFalse;
-      return(MagickTrue);
+      return(SyncImagePixelCache(image,exception));
     }
-  status=MagickTrue;
   image->mask=MagickTrue;
+  if (SyncImagePixelCache(image,exception) == MagickFalse)
+    return(MagickFalse);
+  status=MagickTrue;
   mask_view=AcquireVirtualCacheView(mask,exception);
   image_view=AcquireAuthenticCacheView(image,exception);
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  #pragma omp parallel for schedule(static,4) shared(status) \
+    magick_threads(mask,image,1,1)
+#endif
   for (y=0; y < (ssize_t) image->rows; y++)
   {
     register const Quantum
@@ -3088,7 +3094,7 @@ MagickExport MagickBooleanType SetImageMask(Image *image,const Image *mask,
       }
     for (x=0; x < (ssize_t) image->columns; x++)
     {
-      SetPixelMask(image,GetPixelGray(mask,p),q);
+      SetPixelMask(image,ClampToQuantum(GetPixelIntensity(mask,p)),q);
       p+=GetPixelChannels(mask);
       q+=GetPixelChannels(image);
     }