Commit 22faaddf9 for imagemagick.org
commit 22faaddf9d9a25caaad6b917b6ba7cf95d6ff813
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Mon Apr 6 20:13:48 2026 +0200
Use a better name for the image.
diff --git a/coders/icon.c b/coders/icon.c
index 25a7c31a3..6dc27db26 100644
--- a/coders/icon.c
+++ b/coders/icon.c
@@ -1006,7 +1006,7 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
Image
*images,
- *next;
+ *frame;
MagickBooleanType
adjoin,
@@ -1056,14 +1056,14 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
else
{
scene=0;
- next=image;
+ frame=image;
do
{
if ((image->columns > 512L) || (image->rows > 512L))
ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
scene++;
- next=SyncNextImageInList(next);
- } while ((next != (Image *) NULL) && (adjoin != MagickFalse));
+ frame=SyncNextImageInList(frame);
+ } while ((frame != (Image *) NULL) && (adjoin != MagickFalse));
}
/*
Dump out a ICON header template to be properly initialized later.
@@ -1071,7 +1071,7 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
(void) WriteBlobLSBShort(image,0);
(void) WriteBlobLSBShort(image,1);
(void) WriteBlobLSBShort(image,(unsigned char) scene);
- next=(images != (Image *) NULL) ? images : image;
+ frame=(images != (Image *) NULL) ? images : image;
number_scenes=0;
do
{
@@ -1084,10 +1084,10 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
(void) WriteBlobLSBShort(image,0); /* bits_per_pixel */
(void) WriteBlobLSBLong(image,0); /* size */
(void) WriteBlobLSBLong(image,0); /* offset */
- next=SyncNextImageInList(next);
- } while ((next != (Image *) NULL) && (adjoin != MagickFalse));
+ frame=SyncNextImageInList(frame);
+ } while ((frame != (Image *) NULL) && (adjoin != MagickFalse));
scene=0;
- next=(images != (Image *) NULL) ? images : image;
+ frame=(images != (Image *) NULL) ? images : image;
directory=AcquireIconDirectory(number_scenes);
if (directory == (IconDirectory *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
@@ -1100,9 +1100,9 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
bits_per_pixel,
planes;
- if ((next->columns > 256L) && (next->rows > 256L) &&
- ((next->compression == UndefinedCompression) ||
- (next->compression == ZipCompression)))
+ if ((frame->columns > 256L) && (frame->rows > 256L) &&
+ ((frame->compression == UndefinedCompression) ||
+ (frame->compression == ZipCompression)))
{
Image
*write_image;
@@ -1116,7 +1116,7 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
unsigned char
*png;
- write_image=CloneImage(next,0,0,MagickTrue,exception);
+ write_image=CloneImage(frame,0,0,MagickTrue,exception);
if (write_image == (Image *) NULL)
{
directory=RelinquishIconDirectory(directory);
@@ -1170,10 +1170,10 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
/*
Initialize ICON raster file header.
*/
- (void) TransformImageColorspace(next,sRGBColorspace,exception);
- if ((next->storage_class != DirectClass) && (next->colors > 256))
- (void) SetImageStorageClass(next,DirectClass,exception);
- if (next->storage_class == DirectClass)
+ (void) TransformImageColorspace(frame,sRGBColorspace,exception);
+ if ((frame->storage_class != DirectClass) && (frame->colors > 256))
+ (void) SetImageStorageClass(frame,DirectClass,exception);
+ if (frame->storage_class == DirectClass)
{
/*
Full color ICON raster.
@@ -1187,43 +1187,43 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
Colormapped ICON raster.
*/
bits_per_pixel=8;
- if (next->colors <= 16)
+ if (frame->colors <= 16)
bits_per_pixel=4;
- if (next->colors <= 2)
+ if (frame->colors <= 2)
bits_per_pixel=1;
number_colors=(size_t) 1 << bits_per_pixel;
- if (number_colors < next->colors)
+ if (number_colors < frame->colors)
{
- (void) SetImageStorageClass(next,DirectClass,exception);
+ (void) SetImageStorageClass(frame,DirectClass,exception);
number_colors=0;
bits_per_pixel=(unsigned short) 24;
}
}
- bytes_per_line=(((next->columns*bits_per_pixel)+31U) &
+ bytes_per_line=(((frame->columns*bits_per_pixel)+31U) &
~31U) >> 3;
- width=(ssize_t) next->columns;
- height=(ssize_t) next->rows;
+ width=(ssize_t) frame->columns;
+ height=(ssize_t) frame->rows;
planes=1;
- image_size=bytes_per_line*next->rows;
+ image_size=bytes_per_line*frame->rows;
size=40;
size+=(4*number_colors);
size+=image_size;
size+=(size_t) ((((width+31U) & ~31U) >> 3)*height);
x_pixels=0;
y_pixels=0;
- switch (next->units)
+ switch (frame->units)
{
case UndefinedResolution:
case PixelsPerInchResolution:
{
- x_pixels=(size_t) (100.0*next->resolution.x/2.54);
- y_pixels=(size_t) (100.0*next->resolution.y/2.54);
+ x_pixels=(size_t) (100.0*frame->resolution.x/2.54);
+ y_pixels=(size_t) (100.0*frame->resolution.y/2.54);
break;
}
case PixelsPerCentimeterResolution:
{
- x_pixels=(size_t) (100.0*next->resolution.x);
- y_pixels=(size_t) (100.0*next->resolution.y);
+ x_pixels=(size_t) (100.0*frame->resolution.x);
+ y_pixels=(size_t) (100.0*frame->resolution.y);
break;
}
}
@@ -1246,18 +1246,18 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
/*
Convert PseudoClass image to a ICON monochrome image.
*/
- for (y=0; y < (ssize_t) next->rows; y++)
+ for (y=0; y < (ssize_t) frame->rows; y++)
{
- p=GetVirtualPixels(next,0,y,next->columns,1,exception);
+ p=GetVirtualPixels(frame,0,y,frame->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
- q=pixels+((ssize_t) next->rows-y-1)*(ssize_t) bytes_per_line;
+ q=pixels+((ssize_t) frame->rows-y-1)*(ssize_t) bytes_per_line;
bit=0;
byte=0;
- for (x=0; x < (ssize_t) next->columns; x++)
+ for (x=0; x < (ssize_t) frame->columns; x++)
{
byte<<=1;
- byte|=(size_t) (GetPixelIndex(next,p) != 0 ? 0x01 : 0x00);
+ byte|=(size_t) (GetPixelIndex(frame,p) != 0 ? 0x01 : 0x00);
bit++;
if (bit == 8)
{
@@ -1265,13 +1265,13 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
bit=0;
byte=0;
}
- p+=(ptrdiff_t) GetPixelChannels(next);
+ p+=(ptrdiff_t) GetPixelChannels(frame);
}
if (bit != 0)
*q++=(unsigned char) (byte << (8-bit));
- if (next->previous == (Image *) NULL)
+ if (frame->previous == (Image *) NULL)
{
- status=SetImageProgress(next,SaveImageTag,y,next->rows);
+ status=SetImageProgress(frame,SaveImageTag,y,frame->rows);
if (status == MagickFalse)
break;
}
@@ -1287,18 +1287,18 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
/*
Convert PseudoClass image to a ICON monochrome image.
*/
- for (y=0; y < (ssize_t) next->rows; y++)
+ for (y=0; y < (ssize_t) frame->rows; y++)
{
- p=GetVirtualPixels(next,0,y,next->columns,1,exception);
+ p=GetVirtualPixels(frame,0,y,frame->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
- q=pixels+((ssize_t) next->rows-y-1)*(ssize_t) bytes_per_line;
+ q=pixels+((ssize_t) frame->rows-y-1)*(ssize_t) bytes_per_line;
nibble=0;
byte=0;
- for (x=0; x < (ssize_t) next->columns; x++)
+ for (x=0; x < (ssize_t) frame->columns; x++)
{
byte<<=4;
- byte|=((size_t) GetPixelIndex(next,p) & 0x0f);
+ byte|=((size_t) GetPixelIndex(frame,p) & 0x0f);
nibble++;
if (nibble == 2)
{
@@ -1306,13 +1306,13 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
nibble=0;
byte=0;
}
- p+=(ptrdiff_t) GetPixelChannels(next);
+ p+=(ptrdiff_t) GetPixelChannels(frame);
}
if (nibble != 0)
*q++=(unsigned char) (byte << 4);
- if (next->previous == (Image *) NULL)
+ if (frame->previous == (Image *) NULL)
{
- status=SetImageProgress(next,SaveImageTag,y,next->rows);
+ status=SetImageProgress(frame,SaveImageTag,y,frame->rows);
if (status == MagickFalse)
break;
}
@@ -1324,20 +1324,20 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
/*
Convert PseudoClass packet to ICON pixel.
*/
- for (y=0; y < (ssize_t) next->rows; y++)
+ for (y=0; y < (ssize_t) frame->rows; y++)
{
- p=GetVirtualPixels(next,0,y,next->columns,1,exception);
+ p=GetVirtualPixels(frame,0,y,frame->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
- q=pixels+((ssize_t) next->rows-y-1)*(ssize_t) bytes_per_line;
- for (x=0; x < (ssize_t) next->columns; x++)
+ q=pixels+((ssize_t) frame->rows-y-1)*(ssize_t) bytes_per_line;
+ for (x=0; x < (ssize_t) frame->columns; x++)
{
- *q++=(unsigned char) GetPixelIndex(next,p);
- p+=(ptrdiff_t) GetPixelChannels(next);
+ *q++=(unsigned char) GetPixelIndex(frame,p);
+ p+=(ptrdiff_t) GetPixelChannels(frame);
}
- if (next->previous == (Image *) NULL)
+ if (frame->previous == (Image *) NULL)
{
- status=SetImageProgress(next,SaveImageTag,y,next->rows);
+ status=SetImageProgress(frame,SaveImageTag,y,frame->rows);
if (status == MagickFalse)
break;
}
@@ -1350,29 +1350,29 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
/*
Convert DirectClass packet to ICON BGR888 or BGRA8888 pixel.
*/
- for (y=0; y < (ssize_t) next->rows; y++)
+ for (y=0; y < (ssize_t) frame->rows; y++)
{
- p=GetVirtualPixels(next,0,y,next->columns,1,exception);
+ p=GetVirtualPixels(frame,0,y,frame->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
- q=pixels+((ssize_t) next->rows-y-1)*(ssize_t) bytes_per_line;
- for (x=0; x < (ssize_t) next->columns; x++)
+ q=pixels+((ssize_t) frame->rows-y-1)*(ssize_t) bytes_per_line;
+ for (x=0; x < (ssize_t) frame->columns; x++)
{
- *q++=ScaleQuantumToChar(GetPixelBlue(next,p));
- *q++=ScaleQuantumToChar(GetPixelGreen(next,p));
- *q++=ScaleQuantumToChar(GetPixelRed(next,p));
- if (next->alpha_trait == UndefinedPixelTrait)
+ *q++=ScaleQuantumToChar(GetPixelBlue(frame,p));
+ *q++=ScaleQuantumToChar(GetPixelGreen(frame,p));
+ *q++=ScaleQuantumToChar(GetPixelRed(frame,p));
+ if (frame->alpha_trait == UndefinedPixelTrait)
*q++=ScaleQuantumToChar(QuantumRange);
else
- *q++=ScaleQuantumToChar(GetPixelAlpha(next,p));
- p+=(ptrdiff_t) GetPixelChannels(next);
+ *q++=ScaleQuantumToChar(GetPixelAlpha(frame,p));
+ p+=(ptrdiff_t) GetPixelChannels(frame);
}
if (bits_per_pixel == 24)
- for (x=3L*(ssize_t) next->columns; x < (ssize_t) bytes_per_line; x++)
+ for (x=3L*(ssize_t) frame->columns; x < (ssize_t) bytes_per_line; x++)
*q++=0x00;
- if (next->previous == (Image *) NULL)
+ if (frame->previous == (Image *) NULL)
{
- status=SetImageProgress(next,SaveImageTag,y,next->rows);
+ status=SetImageProgress(frame,SaveImageTag,y,frame->rows);
if (status == MagickFalse)
break;
}
@@ -1403,7 +1403,7 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
(void) WriteBlobLSBLong(image,(unsigned int) y_pixels);
(void) WriteBlobLSBLong(image,(unsigned int) number_colors);
(void) WriteBlobLSBLong(image,(unsigned int) number_colors);
- if (next->storage_class == PseudoClass)
+ if (frame->storage_class == PseudoClass)
{
unsigned char
*icon_colormap;
@@ -1417,11 +1417,11 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
ThrowICONWriterException(ResourceLimitError,
"MemoryAllocationFailed");
q=icon_colormap;
- for (i=0; i < (ssize_t) next->colors; i++)
+ for (i=0; i < (ssize_t) frame->colors; i++)
{
- *q++=ScaleQuantumToChar((Quantum) next->colormap[i].blue);
- *q++=ScaleQuantumToChar((Quantum) next->colormap[i].green);
- *q++=ScaleQuantumToChar((Quantum) next->colormap[i].red);
+ *q++=ScaleQuantumToChar((Quantum) frame->colormap[i].blue);
+ *q++=ScaleQuantumToChar((Quantum) frame->colormap[i].green);
+ *q++=ScaleQuantumToChar((Quantum) frame->colormap[i].red);
*q++=(unsigned char) 0x00;
}
for ( ; i < (ssize_t) 1UL << bits_per_pixel; i++)
@@ -1441,23 +1441,23 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
/*
Write matte mask.
*/
- scanline_pad=(((next->columns+31U) & ~31U)-next->columns) >> 3;
- for (y=((ssize_t) next->rows - 1); y >= 0; y--)
+ scanline_pad=(((frame->columns+31U) & ~31U)-frame->columns) >> 3;
+ for (y=((ssize_t) frame->rows - 1); y >= 0; y--)
{
unsigned char
bit,
byte;
- p=GetVirtualPixels(next,0,y,next->columns,1,exception);
+ p=GetVirtualPixels(frame,0,y,frame->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
bit=0;
byte=0;
- for (x=0; x < (ssize_t) next->columns; x++)
+ for (x=0; x < (ssize_t) frame->columns; x++)
{
byte<<=1;
- if ((next->alpha_trait != UndefinedPixelTrait) &&
- (GetPixelAlpha(next,p) == (Quantum) TransparentAlpha))
+ if ((frame->alpha_trait != UndefinedPixelTrait) &&
+ (GetPixelAlpha(frame,p) == (Quantum) TransparentAlpha))
byte|=0x01;
bit++;
if (bit == 8)
@@ -1466,7 +1466,7 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
bit=0;
byte=0;
}
- p+=(ptrdiff_t) GetPixelChannels(next);
+ p+=(ptrdiff_t) GetPixelChannels(frame);
}
if (bit != 0)
(void) WriteBlobByte(image,(unsigned char) (byte << (8-bit)));
@@ -1474,20 +1474,20 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
(void) WriteBlobByte(image,(unsigned char) 0);
}
}
- if (GetNextImageInList(next) == (Image *) NULL)
+ if (GetNextImageInList(frame) == (Image *) NULL)
break;
- status=SetImageProgress(next,SaveImagesTag,scene++,number_scenes);
+ status=SetImageProgress(frame,SaveImagesTag,scene++,number_scenes);
if (status == MagickFalse)
break;
- next=SyncNextImageInList(next);
- } while ((next != (Image *) NULL) && (adjoin != MagickFalse));
+ frame=SyncNextImageInList(frame);
+ } while ((frame != (Image *) NULL) && (adjoin != MagickFalse));
offset=SeekBlob(image,0,SEEK_SET);
(void) offset;
(void) WriteBlobLSBShort(image,0);
(void) WriteBlobLSBShort(image,1);
(void) WriteBlobLSBShort(image,(unsigned short) (scene+1));
scene=0;
- next=(images != (Image *) NULL) ? images : image;
+ frame=(images != (Image *) NULL) ? images : image;
do
{
(void) WriteBlobByte(image,directory->icons[scene]->width);
@@ -1501,8 +1501,8 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
(void) WriteBlobLSBLong(image,(unsigned int)
directory->icons[scene]->offset);
scene++;
- next=SyncNextImageInList(next);
- } while ((next != (Image *) NULL) && (adjoin != MagickFalse));
+ frame=SyncNextImageInList(frame);
+ } while ((frame != (Image *) NULL) && (adjoin != MagickFalse));
directory=RelinquishIconDirectory(directory);
(void) CloseBlob(image);
images=DestroyImageList(images);