]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/312
authorCristy <urban-warrior@imagemagick.org>
Sun, 4 Dec 2016 14:02:31 +0000 (09:02 -0500)
committerCristy <urban-warrior@imagemagick.org>
Sun, 4 Dec 2016 14:02:31 +0000 (09:02 -0500)
MagickCore/cache-private.h
MagickCore/cache.c
MagickCore/stream.c

index 9cf9c33c4a144abefa590124e2c4b53410c66cc5..b48f79601b1b2f0072440f12ce19398143abe1c0 100644 (file)
@@ -281,6 +281,7 @@ extern MagickPrivate void
   GetPixelCacheTileSize(const Image *,size_t *,size_t *),
   GetPixelCacheMethods(CacheMethods *),
   ResetPixelCacheEpoch(void),
+  ResetPixelCacheChannels(Image *),
   SetPixelCacheMethods(Cache,CacheMethods *);
 
 #if defined(MAGICKCORE_OPENCL_SUPPORT)
index 72f9134f6d71d9bb4a76d725349a5222383fa98c..304eac4d0849d2926aa8cc302a3bb96e1ae444bd 100644 (file)
@@ -4484,7 +4484,42 @@ MagickPrivate Cache ReferencePixelCache(Cache cache)
 %                                                                             %
 %                                                                             %
 %                                                                             %
-+   R e s e t P i x e l C a c h e E p o c h e                                 %
++   R e s e t P i x e l C a c h e C h a n n e l s                             %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  ResetPixelCacheChannels() resets the pixel cache channels.
+%
+%  The format of the ResetPixelCacheChannels method is:
+%
+%      void ResetPixelCacheChannels(Image *)
+%
+%  A description of each parameter follows:
+%
+%    o image: the image.
+%
+*/
+MagickPrivate void ResetPixelCacheChannels(Image *image)
+{
+  CacheInfo
+    *magick_restrict cache_info;
+
+  assert(image != (const Image *) NULL);
+  assert(image->signature == MagickCoreSignature);
+  assert(image->cache != (Cache) NULL);
+  cache_info=(CacheInfo *) image->cache;
+  assert(cache_info->signature == MagickCoreSignature);
+  cache_info->number_channels=GetPixelChannels(image);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
++   R e s e t P i x e l C a c h e E p o c h                                   %
 %                                                                             %
 %                                                                             %
 %                                                                             %
index 009d10a267fd4bc1708b1507c4d257a3fcfc0f5e..f62e356e5889075278e5e2bdd6657246777bf9d1 100644 (file)
@@ -1012,7 +1012,10 @@ MagickExport Image *ReadStream(const ImageInfo *image_info,StreamHandler stream,
   read_info->stream=stream;
   image=ReadImage(read_info,exception);
   if (image != (Image *) NULL)
-    (void) SyncImagePixelCache(image,exception);
+    {
+      InitializePixelChannelMap(image);
+      ResetPixelCacheChannels(image);
+    }
   read_info=DestroyImageInfo(read_info);
   return(image);
 }