if (ghost_semaphore == (SemaphoreInfo *) NULL)
ActivateSemaphoreInfo(&ghost_semaphore);
LockSemaphoreInfo(ghost_semaphore);
- if (NTGhostscriptGetString("GS_DLL",&is_64_bit_version,program,
- sizeof(program)) == FALSE)
+ if (*program == '\0')
{
- UnlockSemaphoreInfo(ghost_semaphore);
- return(FALSE);
- }
- p=strrchr(program,'\\');
- if (p != (char *) NULL)
- {
- p++;
- *p='\0';
- (void) ConcatenateMagickString(program,is_64_bit_version ?
- "gswin64c.exe" : "gswin32c.exe",sizeof(program));
+ if (NTGhostscriptGetString("GS_DLL",&is_64_bit_version,program,
+ sizeof(program)) == FALSE)
+ {
+ UnlockSemaphoreInfo(ghost_semaphore);
+ return(FALSE);
+ }
+ p=strrchr(program,'\\');
+ if (p != (char *) NULL)
+ {
+ p++;
+ *p='\0';
+ (void) ConcatenateMagickString(program,is_64_bit_version ?
+ "gswin64c.exe" : "gswin32c.exe",sizeof(program));
+ }
}
UnlockSemaphoreInfo(ghost_semaphore);
}
#pragma omp critical (MagickCore_GetImageTotalInkDensity)
#endif
{
- total_ink_density=density;
+ if (density > total_ink_density)
+ total_ink_density=density;
}
p+=GetPixelChannels(image);
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_SetGrayscaleImage)
#endif
- colormap_index[intensity]=(ssize_t) image->colors;
- image->colormap[image->colors].red=(double)
- GetPixelRed(image,q);
- image->colormap[image->colors].green=(double)
- GetPixelGreen(image,q);
- image->colormap[image->colors].blue=(double)
- GetPixelBlue(image,q);
- image->colors++;
+ if (colormap_index[intensity] < 0)
+ {
+ colormap_index[intensity]=(ssize_t) image->colors;
+ image->colormap[image->colors].red=(double)
+ GetPixelRed(image,q);
+ image->colormap[image->colors].green=(double)
+ GetPixelGreen(image,q);
+ image->colormap[image->colors].blue=(double)
+ GetPixelBlue(image,q);
+ image->colors++;
+ }
}
SetPixelIndex(image,(Quantum) colormap_index[intensity],q);
q+=GetPixelChannels(image);
/*
Destroy attribute tag and value.
*/
- attributes[i]=DestroyString(attributes[i]);
+ if (attributes[i] != (char *) NULL)
+ attributes[i]=DestroyString(attributes[i]);
if (attributes[i+1] != (char *) NULL)
attributes[i+1]=DestroyString(attributes[i+1]);
}
attributes[0]=DestroyString(attributes[0]);
for (j=1; attributes[j] != (char *) NULL; j+=3)
{
- attributes[j]=DestroyString(attributes[j]);
+ if (attributes[j] != (char *) NULL)
+ attributes[j]=DestroyString(attributes[j]);
if (attributes[j+1] != (char *) NULL)
attributes[j+1]=DestroyString(attributes[j+1]);
if (attributes[j+2] != (char *) NULL)
#pragma omp critical (DDS_CompressClusterFit)
#endif
{
- VectorCopy43(a,start);
- VectorCopy43(b,end);
- bestError = error;
- besti = i;
- bestj = j;
- bestk = k;
- bestIteration = iterationIndex;
+ if (error < bestError)
+ {
+ VectorCopy43(a,start);
+ VectorCopy43(b,end);
+ bestError = error;
+ besti = i;
+ bestj = j;
+ bestk = k;
+ bestIteration = iterationIndex;
+ }
}
}