*/
static MagickBooleanType
IsColorCacheInstantiated(ExceptionInfo *),
- LoadColorCache(const char *,const char *,const size_t,ExceptionInfo *);
+ LoadColorCache(LinkedListInfo *,const char *,const char *,const size_t,
+ ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadColorCache((const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),0,exception);
+ status&=LoadColorCache(color_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
*/
MagickPrivate MagickBooleanType ColorComponentGenesis(void)
{
- color_semaphore=AcquireSemaphoreInfo();
+ if (color_semaphore == (SemaphoreInfo *) NULL)
+ color_semaphore=AcquireSemaphoreInfo();
return(MagickTrue);
}
\f
*q;
assert(exception != (ExceptionInfo *) NULL);
- if (color_cache == (LinkedListInfo *) NULL)
- if (IfMagickFalse(IsColorCacheInstantiated(exception)))
- return((const ColorInfo *) NULL);
+ if (IfMagickFalse(IsColorCacheInstantiated(exception)))
+ return((const ColorInfo *) NULL);
/*
Strip names of whitespace.
*/
for (i=0; i < (ssize_t) target_image->columns; i++)
{
p=GetCacheViewVirtualPixels(image_view,x+i,y+j,1,1,exception);
+ if (p == (const Quantum *) NULL)
+ break;
GetPixelInfoPixel(image,p,&pixel);
q=GetCacheViewVirtualPixels(target_view,i,j,1,1,exception);
+ if (q == (const Quantum *) NULL)
+ break;
GetPixelInfoPixel(image,q,&target);
if (IfMagickFalse(IsFuzzyEquivalencePixelInfo(&pixel,&target)))
break;
%
% The format of the LoadColorCache method is:
%
-% MagickBooleanType LoadColorCache(const char *xml,const char *filename,
-% const size_t depth,ExceptionInfo *exception)
+% MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
+% const char *xml,const char *filename,const size_t depth,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o exception: return any errors or warnings in this structure.
%
*/
-static MagickBooleanType LoadColorCache(const char *xml,const char *filename,
- const size_t depth,ExceptionInfo *exception)
+static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
+ const char *xml,const char *filename,const size_t depth,
+ ExceptionInfo *exception)
{
char
keyword[MaxTextExtent],
"Loading color file \"%s\" ...",filename);
if (xml == (char *) NULL)
return(MagickFalse);
- if (color_cache == (LinkedListInfo *) NULL)
- {
- color_cache=NewLinkedList(0);
- if (color_cache == (LinkedListInfo *) NULL)
- {
- ThrowFileException(exception,ResourceLimitError,
- "MemoryAllocationFailed",filename);
- return(MagickFalse);
- }
- }
status=MagickTrue;
color_info=(ColorInfo *) NULL;
token=AcquireString(xml);
xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
- status=LoadColorCache(xml,path,depth+1,exception);
+ status&=LoadColorCache(color_cache,xml,path,depth+1,
+ exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}