mean_error,
mean_error_per_pixel;
- size_t
- index;
-
ssize_t
+ index,
y;
assert(image != (Image *) NULL);
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- index=GetPixelIndex(image,p);
+ index=(ssize_t) GetPixelIndex(image,p);
if (image->alpha_trait == BlendPixelTrait)
{
alpha=(double) (QuantumScale*GetPixelAlpha(image,p));
register ssize_t
i;
+ size_t
+ extent;
+
ssize_t
*colormap_index,
j,
assert(image->signature == MagickCoreSignature);
if (image->type != GrayscaleType)
(void) TransformImageColorspace(image,GRAYColorspace,exception);
- if (image->storage_class == PseudoClass)
- colormap_index=(ssize_t *) AcquireQuantumMemory(MagickMax(image->colors+1,
- MaxMap),sizeof(*colormap_index));
- else
- colormap_index=(ssize_t *) AcquireQuantumMemory(MagickMax(MaxColormapSize+1,
- MaxMap),sizeof(*colormap_index));
+ extent=MagickMax(image->colors+1,MagickMax(MaxColormapSize,MaxMap+1));
+ colormap_index=(ssize_t *) AcquireQuantumMemory(extent,
+ sizeof(*colormap_index));
if (colormap_index == (ssize_t *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
if (image->storage_class != PseudoClass)
{
- (void) memset(colormap_index,(-1),MaxColormapSize*
- sizeof(*colormap_index));
+ (void) memset(colormap_index,(-1),extent*sizeof(*colormap_index));
if (AcquireImageColormap(image,MaxColormapSize,exception) == MagickFalse)
{
colormap_index=(ssize_t *) RelinquishMagickMemory(colormap_index);
}
image_view=DestroyCacheView(image_view);
}
+ (void) memset(colormap_index,0,extent*sizeof(*colormap_index));
for (i=0; i < (ssize_t) image->colors; i++)
image->colormap[i].alpha=(double) i;
qsort((void *) image->colormap,image->colors,sizeof(PixelInfo),