% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
*magick_restrict cache_info;
char
- *synchronize;
+ *value;
cache_info=(CacheInfo *) AcquireQuantumMemory(1,sizeof(*cache_info));
if (cache_info == (CacheInfo *) NULL)
cache_info->nexus_info=AcquirePixelCacheNexus(cache_info->number_threads);
if (cache_info->nexus_info == (NexusInfo **) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
- synchronize=GetEnvironmentValue("MAGICK_SYNCHRONIZE");
- if (synchronize != (const char *) NULL)
+ value=GetEnvironmentValue("MAGICK_SYNCHRONIZE");
+ if (value != (const char *) NULL)
{
- cache_info->synchronize=IsStringTrue(synchronize);
- synchronize=DestroyString(synchronize);
+ cache_info->synchronize=IsStringTrue(value);
+ value=DestroyString(value);
+ }
+ value=GetPolicyValue("cache:synchronize");
+ if (value != (const char *) NULL)
+ {
+ cache_info->synchronize=IsStringTrue(value);
+ value=DestroyString(value);
}
cache_info->semaphore=AcquireSemaphoreInfo();
cache_info->reference_count=1;
*buffer;
/*
- Clone pixel cache on disk with identifcal morphology.
+ Clone pixel cache on disk with identical morphology.
*/
if ((OpenPixelCacheOnDisk(cache_info,ReadMode) == MagickFalse) ||
(OpenPixelCacheOnDisk(clone_info,IOMode) == MagickFalse))
assert(cache_info->signature == MagickCoreSignature);
if (cache_info->type == UndefinedCache)
return((const Quantum *) NULL);
+#if defined(MAGICKCORE_OPENCL_SUPPORT)
+ CopyOpenCLBuffer(cache_info);
+#endif
region.x=x;
region.y=y;
region.width=columns;
virtual_nexus=AcquirePixelCacheNexus(1);
if (virtual_nexus == (NexusInfo **) NULL)
{
- if (virtual_nexus != (NexusInfo **) NULL)
- virtual_nexus=DestroyPixelCacheNexus(virtual_nexus,1);
(void) ThrowMagickException(exception,GetMagickModule(),CacheError,
"UnableToGetCacheNexus","`%s'",image->filename);
return((const Quantum *) NULL);
case BlackVirtualPixelMethod:
{
for (i=0; i < (ssize_t) cache_info->number_channels; i++)
- SetPixelChannel(image,(PixelChannel) i,0,virtual_pixel);
+ SetPixelChannel(image,(PixelChannel) i,(Quantum) 0,virtual_pixel);
SetPixelAlpha(image,OpaqueAlpha,virtual_pixel);
break;
}
case TransparentVirtualPixelMethod:
{
for (i=0; i < (ssize_t) cache_info->number_channels; i++)
- SetPixelChannel(image,(PixelChannel) i,0,virtual_pixel);
+ SetPixelChannel(image,(PixelChannel) i,(Quantum) 0,virtual_pixel);
SetPixelAlpha(image,TransparentAlpha,virtual_pixel);
break;
}
*/
cache_anonymous_memory=0;
value=GetPolicyValue("pixel-cache-memory");
+ if (value == (char *) NULL)
+ value=GetPolicyValue("cache:memory-map");
if (LocaleCompare(value,"anonymous") == 0)
{
#if defined(MAGICKCORE_HAVE_MMAP) && defined(MAP_ANONYMOUS)
*offset+=cache_info->length+page_size-(cache_info->length % page_size);
return(MagickTrue);
}
- if ((cache_info->mode != ReadMode) &&
- ((cache_info->type == DiskCache) || (cache_info->type == MapCache)) &&
- (cache_info->reference_count == 1))
- {
- LockSemaphoreInfo(cache_info->semaphore);
- if ((cache_info->mode != ReadMode) &&
- ((cache_info->type == DiskCache) || (cache_info->type == MapCache)) &&
- (cache_info->reference_count == 1))
- {
- /*
- Usurp existing persistent pixel cache.
- */
- if (rename_utf8(cache_info->cache_filename, filename) == 0)
- {
- (void) CopyMagickString(cache_info->cache_filename,filename,
- MagickPathExtent);
- *offset+=cache_info->length+page_size-(cache_info->length %
- page_size);
- UnlockSemaphoreInfo(cache_info->semaphore);
- cache_info=(CacheInfo *) ReferencePixelCache(cache_info);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(CacheEvent,GetMagickModule(),
- "Usurp resident persistent cache");
- return(MagickTrue);
- }
- }
- UnlockSemaphoreInfo(cache_info->semaphore);
- }
/*
Clone persistent pixel cache.
*/
nexus_info->cache=(Quantum *) MagickAssumeAligned(AcquireAlignedMemory(1,
(size_t) nexus_info->length));
if (nexus_info->cache != (Quantum *) NULL)
- ResetMagickMemory(nexus_info->cache,0,(size_t) nexus_info->length);
+ (void) ResetMagickMemory(nexus_info->cache,0,(size_t)
+ nexus_info->length);
}
else
{