diff --git a/magick/cache.c b/magick/cache.c
index 1337847..d63b884 100644
--- a/magick/cache.c
+++ b/magick/cache.c
@@ -526,106 +526,6 @@
% %
% %
% %
-+ C l o n e P i x e l C a c h e N e x u s %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% ClonePixelCacheNexus() clones the source cache nexus to the destination
-% nexus.
-%
-% The format of the ClonePixelCacheNexus() method is:
-%
-% MagickBooleanType ClonePixelCacheNexus(CacheInfo *destination,
-% CacheInfo *source,ExceptionInfo *exception)
-%
-% A description of each parameter follows:
-%
-% o destination: the destination cache nexus.
-%
-% o source: the source cache nexus.
-%
-% o exception: return any errors or warnings in this structure.
-%
-*/
-
-static inline MagickBooleanType AcquireCacheNexusPixels(CacheInfo *cache_info,
- NexusInfo *nexus_info,ExceptionInfo *exception)
-{
- if (nexus_info->length != (MagickSizeType) ((size_t) nexus_info->length))
- return(MagickFalse);
- nexus_info->mapped=MagickFalse;
- nexus_info->cache=(PixelPacket *) AcquireMagickMemory((size_t)
- nexus_info->length);
- if (nexus_info->cache == (PixelPacket *) NULL)
- {
- nexus_info->mapped=MagickTrue;
- nexus_info->cache=(PixelPacket *) MapBlob(-1,IOMode,0,(size_t)
- nexus_info->length);
- }
- if (nexus_info->cache == (PixelPacket *) NULL)
- {
- (void) ThrowMagickException(exception,GetMagickModule(),
- ResourceLimitError,"MemoryAllocationFailed","`%s'",
- cache_info->filename);
- return(MagickFalse);
- }
- return(MagickTrue);
-}
-
-static MagickBooleanType ClonePixelCacheNexus(CacheInfo *destination,
- CacheInfo *source,ExceptionInfo *exception)
-{
- MagickBooleanType
- status;
-
- register ssize_t
- i;
-
- status=MagickTrue;
- for (i=0; i < (ssize_t) source->number_threads; i++)
- {
- register const NexusInfo
- *p;
-
- register NexusInfo
- *q;
-
- p=source->nexus_info[i];
- q=destination->nexus_info[i];
- q->region=p->region;
- q->mapped=MagickFalse;
- q->cache=(PixelPacket *) NULL;
- q->pixels=(PixelPacket *) NULL;
- q->indexes=(IndexPacket *) NULL;
- q->length=0;
- if (p->cache != (PixelPacket *) NULL)
- {
- status=AcquireCacheNexusPixels(source,q,exception);
- if (status != MagickFalse)
- {
- MagickSizeType
- number_pixels;
-
- (void) CopyMagickMemory(q->cache,p->cache,(size_t) p->length);
- q->pixels=q->cache;
- q->indexes=(IndexPacket *) NULL;
- number_pixels=(MagickSizeType) q->region.width*q->region.height;
- if (p->indexes != (IndexPacket *) NULL)
- q->indexes=(IndexPacket *) (q->pixels+number_pixels);
- q->length=p->length;
- }
- }
- }
- return(status);
-}
-
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
+ C l o n e P i x e l C a c h e P i x e l s %
% %
% %
@@ -2217,20 +2117,15 @@
clone_image.reference_count=1;
clone_image.cache=ClonePixelCache(cache_info);
clone_info=(CacheInfo *) clone_image.cache;
- status=ClonePixelCacheNexus(cache_info,clone_info,exception);
+ status=OpenPixelCache(&clone_image,IOMode,exception);
if (status != MagickFalse)
{
- status=OpenPixelCache(&clone_image,IOMode,exception);
+ if (clone != MagickFalse)
+ status=ClonePixelCachePixels(clone_info,cache_info,exception);
if (status != MagickFalse)
{
- if (clone != MagickFalse)
- status=ClonePixelCachePixels(clone_info,cache_info,
- exception);
- if (status != MagickFalse)
- {
- destroy=MagickTrue;
- image->cache=clone_image.cache;
- }
+ destroy=MagickTrue;
+ image->cache=clone_image.cache;
}
}
DestroySemaphoreInfo(&clone_image.semaphore);
@@ -4360,13 +4255,9 @@
cache_info->type=DiskCache;
cache_info->offset=(*offset);
cache_info=(CacheInfo *) image->cache;
- status=ClonePixelCacheNexus(cache_info,clone_info,exception);
+ status=OpenPixelCache(image,IOMode,exception);
if (status != MagickFalse)
- {
- status=OpenPixelCache(image,IOMode,exception);
- if (status != MagickFalse)
- status=ClonePixelCachePixels(cache_info,clone_info,&image->exception);
- }
+ status=ClonePixelCachePixels(cache_info,clone_info,&image->exception);
*offset+=cache_info->length+page_size-(cache_info->length % page_size);
clone_info=(CacheInfo *) DestroyPixelCache(clone_info);
return(status);
@@ -5011,6 +4902,31 @@
% o exception: return any errors or warnings in this structure.
%
*/
+
+static inline MagickBooleanType AcquireCacheNexusPixels(CacheInfo *cache_info,
+ NexusInfo *nexus_info,ExceptionInfo *exception)
+{
+ if (nexus_info->length != (MagickSizeType) ((size_t) nexus_info->length))
+ return(MagickFalse);
+ nexus_info->mapped=MagickFalse;
+ nexus_info->cache=(PixelPacket *) AcquireMagickMemory((size_t)
+ nexus_info->length);
+ if (nexus_info->cache == (PixelPacket *) NULL)
+ {
+ nexus_info->mapped=MagickTrue;
+ nexus_info->cache=(PixelPacket *) MapBlob(-1,IOMode,0,(size_t)
+ nexus_info->length);
+ }
+ if (nexus_info->cache == (PixelPacket *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ ResourceLimitError,"MemoryAllocationFailed","`%s'",
+ cache_info->filename);
+ return(MagickFalse);
+ }
+ return(MagickTrue);
+}
+
static PixelPacket *SetPixelCacheNexusPixels(const Image *image,
const RectangleInfo *region,NexusInfo *nexus_info,ExceptionInfo *exception)
{