]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 7 Feb 2012 13:44:59 +0000 (13:44 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 7 Feb 2012 13:44:59 +0000 (13:44 +0000)
MagickCore/composite.c

index ee6755fe829b5a399cd62644117f6551b1373c15..8c25deffd6164dc7e0cf93b81fcb6ec75d004bf2 100644 (file)
@@ -2283,7 +2283,7 @@ MagickExport MagickBooleanType CompositeImage(Image *image,
 %
 %  The format of the TextureImage method is:
 %
-%      MagickBooleanType TextureImage(Image *image,const Image *texture_image,
+%      MagickBooleanType TextureImage(Image *image,const Image *texture,
 %        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
@@ -2293,8 +2293,8 @@ MagickExport MagickBooleanType CompositeImage(Image *image,
 %    o texture_image: This image is the texture to layer on the background.
 %
 */
-MagickExport MagickBooleanType TextureImage(Image *image,
-  const Image *texture_image,ExceptionInfo *exception)
+MagickExport MagickBooleanType TextureImage(Image *image,const Image *texture,
+  ExceptionInfo *exception)
 {
 #define TextureImageTag  "Texture/Image"
 
@@ -2302,6 +2302,9 @@ MagickExport MagickBooleanType TextureImage(Image *image,
     *image_view,
     *texture_view;
 
+  Image
+    *texture_image;
+
   MagickBooleanType
     status;
 
@@ -2312,12 +2315,15 @@ MagickExport MagickBooleanType TextureImage(Image *image,
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(image->signature == MagickSignature);
+  if (texture == (const Image *) NULL)
+    return(MagickFalse);
+  if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
+    return(MagickFalse);
+  texture_image=CloneImage(texture,0,0,MagickTrue,exception);
   if (texture_image == (const Image *) NULL)
     return(MagickFalse);
   (void) SetImageVirtualPixelMethod(texture_image,TileVirtualPixelMethod,
     exception);
-  if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
-    return(MagickFalse);
   status=MagickTrue;
   if ((image->compose != CopyCompositeOp) &&
       ((image->compose != OverCompositeOp) || (image->matte != MagickFalse) ||
@@ -2366,6 +2372,7 @@ MagickExport MagickBooleanType TextureImage(Image *image,
       }
       (void) SetImageProgress(image,TextureImageTag,(MagickOffsetType)
         image->rows,image->rows);
+      texture_image=DestroyImage(texture_image);
       return(status);
     }
   /*
@@ -2466,5 +2473,6 @@ MagickExport MagickBooleanType TextureImage(Image *image,
   }
   texture_view=DestroyCacheView(texture_view);
   image_view=DestroyCacheView(image_view);
+  texture_image=DestroyImage(texture_image);
   return(status);
 }