GraphicsMagick: TGA: White-space normalization. Eliminate compi...
GraphicsMagick Commits <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.11097.1664633303.1372.graphicsmagick-commit@lists.sourceforge.net> |
changeset 9f0e189bf0ca in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=9f0e189bf0ca summary: TGA: White-space normalization. Eliminate compilation warning about unused indexes variable. diffstat: ChangeLog | 7 +- VisualMagick/installer/inc/version.isx | 4 +- coders/tga.c | 113 ++++++++++++++++---------------- magick/version.h | 4 +- www/Changelog.html | 20 +++++ 5 files changed, 88 insertions(+), 60 deletions(-) diffs (262 lines): diff -r 08975ea83953 -r 9f0e189bf0ca ChangeLog --- a/ChangeLog Sat Oct 01 12:59:36 2022 +0200 +++ b/ChangeLog Sat Oct 01 09:08:09 2022 -0500 @@ -1,3 +1,8 @@ +2022-10-01 Bob Friesenhahn <[email protected]> + + * coders/tga.c: White-space normalization. Eliminate compilation + warning about unused indexes variable. + 2022-10-01 Fojtik Jaroslav <[email protected]> * coders/tga.c Monochromatic TGA could be written. @@ -8,7 +13,7 @@ 2022-09-28 Fojtik Jaroslav <[email protected]> - * PerlMagick/t/input_mono.tga Added monochromatic TGA sample generated + * PerlMagick/t/input_mono.tga Added monochromatic TGA sample generated by Graphics Workshop. 2022-09-25 Bob Friesenhahn <[email protected]> diff -r 08975ea83953 -r 9f0e189bf0ca VisualMagick/installer/inc/version.isx --- a/VisualMagick/installer/inc/version.isx Sat Oct 01 12:59:36 2022 +0200 +++ b/VisualMagick/installer/inc/version.isx Sat Oct 01 09:08:09 2022 -0500 @@ -10,5 +10,5 @@ #define public MagickPackageName "GraphicsMagick" #define public MagickPackageVersion "1.4" -#define public MagickPackageVersionAddendum ".020220925" -#define public MagickPackageReleaseDate "snapshot-20220925" +#define public MagickPackageVersionAddendum ".020221001" +#define public MagickPackageReleaseDate "snapshot-20221001" diff -r 08975ea83953 -r 9f0e189bf0ca coders/tga.c --- a/coders/tga.c Sat Oct 01 12:59:36 2022 +0200 +++ b/coders/tga.c Sat Oct 01 09:08:09 2022 -0500 @@ -328,7 +328,7 @@ */ if (!(((tga_info.bits_per_pixel > 1) && (tga_info.bits_per_pixel < 17)) || (tga_info.bits_per_pixel == 24 ) || (tga_info.bits_per_pixel == 32) || - (tga_info.bits_per_pixel == 1 && tga_info.image_type == TGAMonochrome) )) + (tga_info.bits_per_pixel == 1 && tga_info.image_type == TGAMonochrome) )) ThrowReaderException(CoderError,DataStorageTypeIsNotSupported,image); /* @@ -538,20 +538,21 @@ if (!skip) switch (tga_info.bits_per_pixel) { - case 1:if((x&7) == 0) // Read byte every 8th bit. - index = ReadBlobByte(image); - else - index <<= 1; - if(image->storage_class == PseudoClass) - { - pixel = image->colormap[indexes[x] = ((index & 128) ? 1 : 0)]; - } - else - { - pixel.blue=pixel.green=pixel.red = (index & 128)?MaxRGB:0; - } - break; - + case 1: + if ((x&7) == 0) // Read byte every 8th bit. + index = ReadBlobByte(image); + else + index <<= 1; + if (image->storage_class == PseudoClass) + { + pixel = image->colormap[indexes[x] = ((index & 128) ? 1 : 0)]; + } + else + { + pixel.blue=pixel.green=pixel.red = (index & 128)?MaxRGB:0; + } + break; + case 8: default: { @@ -563,7 +564,7 @@ { VerifyColormapIndex(image,index); pixel=image->colormap[index]; - indexes[x] = index; + indexes[x] = index; } else { @@ -642,16 +643,16 @@ break; } } - else /* skip==true - Duplicate index on RLE repeat. */ - { - if(image->storage_class == PseudoClass) - indexes[x] = index; - } + else /* skip==true - Duplicate index on RLE repeat. */ + { + if (image->storage_class == PseudoClass) + indexes[x] = index; + } if (EOFBlob(image)) status = MagickFail; if (status == MagickFail) - ThrowReaderException(CorruptImageError,UnableToReadImageData,image); + ThrowReaderException(CorruptImageError,UnableToReadImageData,image); *q++=pixel; } /* @@ -659,12 +660,12 @@ tested here. This test case can never be true and so it is commented out for the moment. - if (((unsigned char) (tga_info.attributes & 0xc0) >> 6) == 4) + if (((unsigned char) (tga_info.attributes & 0xc0) >> 6) == 4) offset+=4; - else + else */ if (((unsigned char) (tga_info.attributes & 0xc0) >> 6) == 2) - offset+=2; + offset+=2; else offset++; if (offset >= image->rows) @@ -862,8 +863,8 @@ register const PixelPacket *p; - register const IndexPacket - *indexes; + /* register const IndexPacket + *indexes; */ register long x; @@ -1049,7 +1050,7 @@ Dump colormap to file (blue, green, red byte order). */ targa_colormap=MagickAllocateResourceLimitedArray(unsigned char *, - tga_info.colormap_length,3); + tga_info.colormap_length,3); if (targa_colormap == (unsigned char *) NULL) ThrowWriterException(ResourceLimitError,MemoryAllocationFailed, image); @@ -1066,40 +1067,42 @@ } /* Convert MIFF to TGA raster pixels. - */ + */ count = (size_t)((7+MagickArraySize(tga_info.bits_per_pixel,image->columns)) >> 3); /*7 bits padding. */ tga_pixels = MagickAllocateResourceLimitedMemory(unsigned char *,count); if (tga_pixels == (unsigned char *) NULL) ThrowWriterException(ResourceLimitError,MemoryAllocationFailed,image); - for(y=(long)(image->rows-1); y>=0; y--) + for (y=(long)(image->rows-1); y>=0; y--) { p = AcquireImagePixels(image,0,y,image->columns,1,&image->exception); - if(p == (const PixelPacket *) NULL) - break; - indexes = AccessImmutableIndexes(image); + if (p == (const PixelPacket *) NULL) + break; + /* indexes = AccessImmutableIndexes(image); */ - switch(tga_info.image_type) - { - case TGAMonochrome: if(ExportImagePixelArea(image,GrayQuantum,tga_info.bits_per_pixel,tga_pixels,0,0) != MagickPass) - status=MagickFail; - break; - case TGAColormap: if(ExportImagePixelArea(image,IndexQuantum,tga_info.bits_per_pixel,tga_pixels,0,0) != MagickPass) - status=MagickFail; - break; - default: /* TrueColor RGB (quantum type is BGR, ExportImagePixelArea is useless.)*/ - q = tga_pixels; - for(x=0; x<(long)image->columns; x++) - { - *q++=ScaleQuantumToChar(p->blue); - *q++=ScaleQuantumToChar(p->green); - *q++=ScaleQuantumToChar(p->red); - if(image->matte) - *q++=ScaleQuantumToChar(MaxRGB-p->opacity); - p++; - } - break; - } - (void)WriteBlob(image,count,(char*)tga_pixels); + switch (tga_info.image_type) + { + case TGAMonochrome: + if (ExportImagePixelArea(image,GrayQuantum,tga_info.bits_per_pixel,tga_pixels,0,0) != MagickPass) + status=MagickFail; + break; + case TGAColormap: + if (ExportImagePixelArea(image,IndexQuantum,tga_info.bits_per_pixel,tga_pixels,0,0) != MagickPass) + status=MagickFail; + break; + default: /* TrueColor RGB (quantum type is BGR, ExportImagePixelArea is useless.)*/ + q = tga_pixels; + for (x=0; x<(long)image->columns; x++) + { + *q++=ScaleQuantumToChar(p->blue); + *q++=ScaleQuantumToChar(p->green); + *q++=ScaleQuantumToChar(p->red); + if (image->matte) + *q++=ScaleQuantumToChar(MaxRGB-p->opacity); + p++; + } + break; + } + (void) WriteBlob(image,count,(char*)tga_pixels); if (image->previous == (Image *) NULL) if (QuantumTick(y,image->rows)) if (!MagickMonitorFormatted(y,image->rows,&image->exception, diff -r 08975ea83953 -r 9f0e189bf0ca magick/version.h --- a/magick/version.h Sat Oct 01 12:59:36 2022 +0200 +++ b/magick/version.h Sat Oct 01 09:08:09 2022 -0500 @@ -38,8 +38,8 @@ #define MagickLibVersion 0x272400 #define MagickLibVersionText "1.4" #define MagickLibVersionNumber 27,24,0 -#define MagickChangeDate "20220925" -#define MagickReleaseDate "snapshot-20220925" +#define MagickChangeDate "20221001" +#define MagickReleaseDate "snapshot-20221001" /* The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines diff -r 08975ea83953 -r 9f0e189bf0ca www/Changelog.html --- a/www/Changelog.html Sat Oct 01 12:59:36 2022 +0200 +++ b/www/Changelog.html Sat Oct 01 09:08:09 2022 -0500 @@ -34,6 +34,26 @@ <div class="document"> +<p>2022-10-01 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p> +<blockquote> +<ul class="simple"> +<li>coders/tga.c: White-space normalization. Eliminate compilation +warning about unused indexes variable.</li> +</ul> +</blockquote> +<p>2022-10-01 Fojtik Jaroslav <<a class="reference external" href="mailto:JaFojtik%40yandex.com">JaFojtik<span>@</span>yandex<span>.</span>com</a>></p> +<blockquote> +* coders/tga.c Monochromatic TGA could be written.</blockquote> +<p>2022-09-29 Fojtik Jaroslav <<a class="reference external" href="mailto:JaFojtik%40yandex.com">JaFojtik<span>@</span>yandex<span>.</span>com</a>></p> +<blockquote> +* coders/tga.c Monochromatic TGA could be read.</blockquote> +<p>2022-09-28 Fojtik Jaroslav <<a class="reference external" href="mailto:JaFojtik%40yandex.com">JaFojtik<span>@</span>yandex<span>.</span>com</a>></p> +<blockquote> +<ul class="simple"> +<li>PerlMagick/t/input_mono.tga Added monochromatic TGA sample generated +by Graphics Workshop.</li> +</ul> +</blockquote> <p>2022-09-25 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p> <blockquote> <ul class="simple">