Skip to content

Commit

Permalink
https://github.com/ImageMagick/ImageMagick/issues/312
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Dec 4, 2016
1 parent 49e2e6b commit 32867fe
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions MagickCore/cache-private.h
Expand Up @@ -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)
Expand Down
37 changes: 36 additions & 1 deletion MagickCore/cache.c
Expand Up @@ -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);
}

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ R e s e t P i x e l C a c h e E p o c h %
% %
% %
% %
Expand Down
5 changes: 4 additions & 1 deletion MagickCore/stream.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit 32867fe

Please sign in to comment.