assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- if (image->cache == (void *) NULL)
- return;
- image->cache=DestroyPixelCache(image->cache);
+ if (image->cache != (void *) NULL)
+ image->cache=DestroyPixelCache(image->cache);
}
\f
/*
break;
r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
(void) memcpy(q,p,(size_t) length*cache_info->number_channels*sizeof(*p));
- q+=length*cache_info->number_channels;
+ q+=cache_info->number_channels*length;
if ((r != (void *) NULL) && (s != (const void *) NULL))
{
(void) memcpy(s,r,(size_t) length);
cache_info->metacontent=(void *) NULL;
if (cache_info->metacontent_extent != 0)
cache_info->metacontent=(void *) (cache_info->pixels+
- number_pixels*cache_info->number_channels);
+ cache_info->number_channels*number_pixels);
if ((source_info.storage_class != UndefinedClass) &&
(mode != ReadMode))
{
cache_info->metacontent=(void *) NULL;
if (cache_info->metacontent_extent != 0)
cache_info->metacontent=(void *) (cache_info->pixels+
- number_pixels*cache_info->number_channels);
+ cache_info->number_channels*number_pixels);
if ((source_info.storage_class != UndefinedClass) &&
(mode != ReadMode))
{
length=extent;
rows=1UL;
}
- p=cache_info->pixels+offset*cache_info->number_channels;
+ p=cache_info->pixels+cache_info->number_channels*offset;
for (y=0; y < (ssize_t) rows; y++)
{
(void) memcpy(q,p,(size_t) length);
return(MagickTrue);
offset=(MagickOffsetType) nexus_info->region.y*cache_info->columns+
nexus_info->region.x;
- status=nexus_info->pixels == (cache_info->pixels+offset*
- cache_info->number_channels) ? MagickTrue : MagickFalse;
+ status=nexus_info->pixels == (cache_info->pixels+cache_info->number_channels*
+ offset) ? MagickTrue : MagickFalse;
return(status);
}
/*
Pixels are stored in a staging region until they are synced to the cache.
*/
- length=number_pixels*cache_info->number_channels*sizeof(Quantum);
+ length=number_pixels*cache_info->number_channels*sizeof(*nexus_info->pixels);
if (cache_info->metacontent_extent != 0)
length+=number_pixels*cache_info->metacontent_extent;
if (nexus_info->cache == (Quantum *) NULL)
nexus_info->pixels=nexus_info->cache;
nexus_info->metacontent=(void *) NULL;
if (cache_info->metacontent_extent != 0)
- nexus_info->metacontent=(void *) (nexus_info->pixels+number_pixels*
- cache_info->number_channels);
+ nexus_info->metacontent=(void *) (nexus_info->pixels+
+ (cache_info->number_channels*number_pixels));
PrefetchPixelCacheNexusPixels(nexus_info,mode);
nexus_info->authentic_pixel_cache=IsPixelCacheAuthentic(cache_info,
nexus_info);